Log in

View Full Version : convert file extension



jr_yeo
12-01-2008, 04:40 AM
how to convert one file extension to another in a single command line in linux?
i want to convert *.html to *.php recursively and retain the original file.

Twey
12-01-2008, 06:52 AM
Well, one way, perhaps not the most elegant:
find -iname '*.php' /top/directory -exec cp {} `dirname {}`/`basename {} .php`.html \;I'm pretty sure something better is possible in zsh with regular expressions, but it's too early for the man pages to make sense. :p