Friday, April 25, 2008

Renaming all files in folder - Unix

Say, if you want to rename all the files in a folder and add an extension, use this


for file in *.pl ; do mv $file `echo $file | sed 's/\(.*\.\)pl/\1ppl/'` ; done

This converts all the files in this folder from *.pl to *.ppl

No comments: