Page 1 of 1

Removing last character in filename

PostPosted: Sat Jan 09, 2021 5:56 pm
by odegnan
How can I create a rule to remove the last character of a file name? Example: "this0image -1-.png". REMOVE the last '-' character to read "this0image -1.png"

Re: Removing last character in filename

PostPosted: Mon Jan 11, 2021 11:32 am
by Mr_Noodle
Look up "match patterns" in the manual. You can create a pattern like "(• saved part of filename)(character)" where (•saved part of filename) is a custom attribute you define that matches "anything".

Re: Removing last character in filename

PostPosted: Mon Jan 11, 2021 5:39 pm
by odegnan
Not sure what to do with this information. I’m using a pattern matching algorithm to find the character. But how do I actually replace it then?

Re: Removing last character in filename

PostPosted: Tue Jan 12, 2021 11:19 am
by Mr_Noodle
You use a custom attribute to match everything but that character. Try implementing the pattern I gave you.

Re: Removing last character in filename

PostPosted: Wed Jan 13, 2021 10:06 am
by odegnan
I did that and I am able. to find a match. But I do not know how to rename the file so that the matched character "-" at the end of the file name is deleted. That is where I am stuck right now. Your help is greatly appreciated.

Re: Removing last character in filename

PostPosted: Wed Jan 13, 2021 10:40 am
by Mr_Noodle
If you created a custom attribute with everything but the last character, then in your Rename pattern, use that attribute. It has all the text you wanted to save.

Re: Removing last character in filename

PostPosted: Sat Jan 16, 2021 3:34 pm
by odegnan
Thanks, I do have it working in one rule now. But it seems that when this rule is second in line, it doesn't execute after the first rule for the folder. Thoughts why only the first rule runs?

Re: Removing last character in filename

PostPosted: Sat Jan 16, 2021 3:38 pm
by odegnan
NEVER MIND. I got it now: had to set the Continue processing rules. Somewhat not intuitive because a user assumes the rules run in a succession of each other in the rules list for a folder. ;-)

Re: Removing last character in filename

PostPosted: Mon Jan 18, 2021 11:29 am
by Mr_Noodle
Users only assume that when that is what they want to happen. Most of the time, users will be surprised if additional rules are running on a file when it matches the one they created for it.