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 December 28, 2006 03:57 PM | TrackBackI finally found this post in Google, and it was just what I needed to get PHP Postit working on my site. It needs PHP5, and I had to change all the extensions.
Lane
DoctorLester.com
Thank you for this.
I had one problem however, I had to remove the |sh off of the end. It wouldn't work on my server with it there.
Posted by: Stephen Melrose at April 15, 2008 09:26 AMUnlike, Stephen, I had to leave the ending:
| sh
I also put double quotes around the names to help avoid problems with spaces, and I prefer using colons instead of forward slashes with sed (doesn't matter in this case), so my command looks like this:
find . | sed 's:\(.*\)\.php:mv "\1.php" "\1.php4":'|shPosted by: Michael Vogt at September 9, 2008 08:21 AM