Removing last character in filename

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Removing last character in filename 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"
odegnan
 
Posts: 5
Joined: Sat Jan 09, 2021 5:53 pm

Re: Removing last character in filename 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".
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Removing last character in filename 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?
odegnan
 
Posts: 5
Joined: Sat Jan 09, 2021 5:53 pm

Re: Removing last character in filename 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.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Removing last character in filename 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.
odegnan
 
Posts: 5
Joined: Sat Jan 09, 2021 5:53 pm

Re: Removing last character in filename 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.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Removing last character in filename 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?
odegnan
 
Posts: 5
Joined: Sat Jan 09, 2021 5:53 pm

Re: Removing last character in filename 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. ;-)
odegnan
 
Posts: 5
Joined: Sat Jan 09, 2021 5:53 pm

Re: Removing last character in filename 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.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support