Trim doesn't remove blank spaces

Advanced Renamer forum
#1 : 05/02-18 14:19
Danilo Casati
Danilo Casati
Posts: 1
Program is working correctly, I can add many rules.
Just only one doesn't work: if I add TRIM rule, blank spaces are not removed from my filenames.

How can I fix this problem?

05/02-18 14:19
#2 : 06/02-18 07:33
Brian Hanlon
Brian Hanlon
Posts: 29
Reply to #1:
If you are attempting to "Trim()" in JS, make certain that you have the command correctly formed. If you want to "Trim" via a 'Standard' Rule, just 'Replace' ALL " " (single space) with 'Text to replace with': "" (Empty, nul, nothing.

However, if you need to 'Trim' spaces from start or end of filenames (usually after other Rules have left blanks all over the place because we didn't set the Rule properly - LOL), then you' have to use Regular Expressions eg: Replace: '^.*(\w*)' (etc) with: \1 (etc)

For example: To clean up a set of filenames with varying rubbish preceding a set of four digits, THEN the data I wish to retain - right through to the end of the filename:
Text to be replaced: '^(.*) - (.*) - \d\d\d\d(.*)$' (Lose the Quotes)
Replace with: '\3' (Lose the Quotes)
Occurrence: 1st
[x] Use regular expressions

With a few earlier Rules to kill '-\_\!\~', Replace 'Cars' with nul, replace multiple spaces with a single space, remove the 'Imgur', and fix the extension from .jpeg to .jpg;

'Cars - hollywood vehicles - 0005dodge_-_Imgur_005.jpeg'
' hollywood vehicles 0005dodge 005.jpg'
then the Rule above turns it into:
'dodge 005.jpg'
and a 'Capitalise First Letter of each word' will give me:
'Dodge 005.jpg'
Which fits my filing system a lot better.

Hope this all makes sense and helps you with your task.


If this brilliant little tool has saved you time, or helped get your files in a better order, or just cleaned-up the crazy names from downloaded files, maybe you could donate a Dollar or Ten to Kim?

06/02-18 07:33