Hi all, let's say I have a directory called e.g.
"Movie.Title.In.English (1999) Movie Title In Original Language"
Is there any smart way for me to tell ant renamer to perform a macro and obtain:
"Movie title in english (Movie title in original language) [1999]"
What I did so far was is:
Change case in lowercase
Replace . with space
Replace ( with [
Replace ) with ]
Change first letter uppercase
This gives me:
Movie title in english [1999] Movie title in original language
However I can't find a way to say "Take whatever is after ) in the original name and (after the batch abov) movie it just before [ adding () around it"
Perhaps I'm missing something?
Cheers
rs232
move string within name?
Hi,
Using regular expressions it is quite easy
Expression = (.+) \(([0-9]+)\) (.+)\.([a-zA-Z0-9]+)
New name = $1 ($3) [$2].$4
(.+) => any character (1 or more)
\(([0-9]+)\) => numbers (1 or more) between parenthesis
(.+) => any character (1 or more)
\.([a-zA-Z0-9]+) => dot followed by letters and numbers (1 or more), i.e. the extension
If you already renamed your files with [ ] instead of ( ) you can use this expression :
(.+) \[([0-9]+)\] (.+)\.([a-zA-Z0-9]+)
When using ( ) or [ ] as literal characters these expressions aren't easy to read, as these characters have other meaning, those used literally must follow a backslash.
Using regular expressions it is quite easy
Expression = (.+) \(([0-9]+)\) (.+)\.([a-zA-Z0-9]+)
New name = $1 ($3) [$2].$4
(.+) => any character (1 or more)
\(([0-9]+)\) => numbers (1 or more) between parenthesis
(.+) => any character (1 or more)
\.([a-zA-Z0-9]+) => dot followed by letters and numbers (1 or more), i.e. the extension
If you already renamed your files with [ ] instead of ( ) you can use this expression :
(.+) \[([0-9]+)\] (.+)\.([a-zA-Z0-9]+)
When using ( ) or [ ] as literal characters these expressions aren't easy to read, as these characters have other meaning, those used literally must follow a backslash.
Thanks for the quick replay! It doesn't seem to be working using regular expressions.
Let's use a real example:
applying the regular expression only as advised I get:
The $1 ($3) [$2].$4 doesn't seem to be effective, surely I'm doing something wrong.
Beside this I've noticed that removing spaces (string replacement) doesn't work when e.g. I match " " (double space) and replace with " " (single space). Can I achieve this in another way? I guess regular expression is the tool for the job...
Let's use a real example:
Code: Select all
The Silence of the Sea (1949) e Silence de la Mer
Code: Select all
The silence of the sea (1949) e silence de la Mer
Beside this I've noticed that removing spaces (string replacement) doesn't work when e.g. I match " " (double space) and replace with " " (single space). Can I achieve this in another way? I guess regular expression is the tool for the job...
Well I tested before posting...
Do your files have extensions?
I assumed they do, though you do not include them in your examples
Double spaces replacement work as well...
Can you make a screenshot of the program window showing something that does not work? (with the concerned file shown in the preview area on the Action page)
Do your files have extensions?
I assumed they do, though you do not include them in your examples
Double spaces replacement work as well...
Can you make a screenshot of the program window showing something that does not work? (with the concerned file shown in the preview area on the Action page)
Hi again, and thanks for the replay!
I forgot to mention that these are directories so nothing with extension really.
I'm attaching two images in regards the regular expression as requested.


About the multiple spaces detection, it's a bit confusing to me, as you can see in this screenshot below the real time preview seems to work properly (there are two spaces after the second number 7 found in the original filename that are removed thanks to string replacement).

Where the second image uses the preview icon to visualise the very same efect (same action applied). If I'm not mistaken in this second preview the double space after the second 7 is not affected.

Thanks!
I forgot to mention that these are directories so nothing with extension really.
I'm attaching two images in regards the regular expression as requested.


About the multiple spaces detection, it's a bit confusing to me, as you can see in this screenshot below the real time preview seems to work properly (there are two spaces after the second number 7 found in the original filename that are removed thanks to string replacement).

Where the second image uses the preview icon to visualise the very same efect (same action applied). If I'm not mistaken in this second preview the double space after the second 7 is not affected.

Thanks!
If there is no extension, you should remove the \. and all what follows in the expression
And in the new name, remove the .$4 (which was the extension part)
For the double space, are you sure you were previewing the string replacement? As in the first screenshot you added the regular expression to the batch, it may take that one rather than the currently selected action.
And in the new name, remove the .$4 (which was the extension part)
For the double space, are you sure you were previewing the string replacement? As in the first screenshot you added the regular expression to the batch, it may take that one rather than the currently selected action.