Replace with function

Hi. I've read the FAQs and the help files, and I maybe I am just not understanding. But here's what I tried to do.

I went into View|Customize Columns and created a new column to test my formula. My formula is $left(%_filename%,$len(%_filename%)-2). What it is supposed to do is remove the last two characters in the file name. But it displays the whole file name. So I'm wondering if I'm not allowed to subtract from the length.

Anyway, maybe I should explain why I am testing this formula, because maybe I should not even be doing it this way. Maybe there is an easier method. I want to batch replace the Album tags with the Filenames, and remove the trailing numbers during the replace. If there is a replace formula that can do this, please tell me.

Also, after the numbers are removed, I want to remove any trailing underline characters, if they exist. So I would appreciate a formula for this. Or both at once.

BTW, my concentration is not good these days, and I really did try to figure this out from the information here. Any help will be greatly appreciated.

Please try this action:

Action type: Format value
Field: ALBUM
Formatstring: $trim($left(%_filename%,$sub($len(%filename%),2)),)

I tried your suggestion and it worked well. I would not have been able to develop that formula from what I know. Thank you for your help.