How to rename parts of filenames with certain target patterns?
Posted: 27 Dec 2019 01:39
How can I (from cmdline!) rename parts of filename (and leave the remaining part untouched)?
Simplified example:
Assume I have the following files:
test aabb cc 13412542552.pdf
second aabb cc 324236236.pdf
other aabb cc 2345325.pdf
Now I want to replace the pattern " aabb cc " by " (newpattern 2019) " so that the filenames are as follows:
test (newpattern 2019) 13412542552.pdf
second (newpattern 2019) 324236236.pdf
other (newpattern 2019) 2345325.pdf
Possible other files should be renamed accordingly.
Keep in mind that a file like:
norename-aabb cc 356345634.pdf
should NOT be renamed (mind the enclosing blanks!).
How can I achieve this (in general)?
If necessary a (free), simple, third party cmdline tool is acceptable.
No difficult regular expressions are necessary.
Peter
Simplified example:
Assume I have the following files:
test aabb cc 13412542552.pdf
second aabb cc 324236236.pdf
other aabb cc 2345325.pdf
Now I want to replace the pattern " aabb cc " by " (newpattern 2019) " so that the filenames are as follows:
test (newpattern 2019) 13412542552.pdf
second (newpattern 2019) 324236236.pdf
other (newpattern 2019) 2345325.pdf
Possible other files should be renamed accordingly.
Keep in mind that a file like:
norename-aabb cc 356345634.pdf
should NOT be renamed (mind the enclosing blanks!).
How can I achieve this (in general)?
If necessary a (free), simple, third party cmdline tool is acceptable.
No difficult regular expressions are necessary.
Peter