Batch rename directories?

I have several directories with the format of the year, month, and day followed by a description of the event. For example: "2012 05 26 - EventA", "2012 05 26 - EventB". What I would like to do is rename all these directories so that the spaces between the numbers in the date are replaced with dashes. Thus, "2012 05 26 - EventA" becomes "2012-05-26 - EventA". I know I can do this one folder at a time with the mv command, but is there a way to do this in a batch process with wildcards somehow?


Solution 1:

Try pyRenamer: http://www.webupd8.org/2010/01/pyrenamer-easy-mass-file-renaming-in.html

or similar: http://alternativeto.net/software/pyrenamer/?platform=linux&license=free

Solution 2:

You can also use mmv.

sudo aptitude install mmv

#> mmv "201? * * - Event?" "201#1-#2-#3 - Event#4"

Solution 3:

I wanted to rename multiple directories (folders, not files) and could not figure out if this is possible with pyRenamer. GPRename (http://gprename.sourceforge.net/) does the trick quite nicely though.

Ubuntu users should have GPRename in their reposiories and can run this command to install GPRename:

sudo apt-get install gprename