December 28, 2006

Rename files recursively in Linux/Unix

While one would think that the 'rename' command would have a recursive option, it (for some reason, I hope is good) does not.

So, rather than typing...
rename -r *.php *.php4
One must type...
find . | sed 's/\(.*\)\.php/mv \1.php \1.php4/'|sh
which works beautiful, thought it's one of the uglier command line statements I've seen.

Special thanks to Brad Garrett for the majority of the line. I added the '.' after 'find'. :)

Posted by TheIdeaMan at 03:57 PM | Comments (3) | TrackBack