I'm trying to use the rename function, supplied as part of cygwin, unix-utils ( Mar22 2015), and it does not function as advertised.
All the examples I've seen indicate this to be the syntax:
rename 's/old pattern/new pattern' *.txt
This is supposed to replace ALL occurrences of file names, containing the old pattern, with the new name, using the new pattern but, instead, it does nothing. Literally. No syntax error. No warning. I enter the command; the command is executed; and the prompt re-appears, but nothing happened. I'm replacing dashes with spaces, so I thought I may need to use an escape character, but it didn't have any effect.
This code works, but only for ONE occurrence of the pattern:
rename "old pattern" "new pattern" *.txt
Am I using the latest version of rename? Is there another command I can use? I am renaming files using "-" instead of spaces, so having to put rename into a loop just to get rid of 1 to 10 dashes in hundreds of files, is really, really lame.
As always your help would be greatly appreciated.
Tony
rename --version
andman rename
should give you some good information.