Wednesday, March 17, 2010

batch rename files: (by hmLyons)
for f in *.txt; do mv ./"$f" "${f%txt}htm"; done
or
find . -name "*.txt" | while read f
do
mv ./"$f" "${f%txt}htm";
done
or
for file in *.htm ;
do mv $file `echo $file | sed 's/\(.*\.\)htm/\1html/'` ;
done


// 120201 // find file names, replace '!' or '|' with '_'
find | grep "[!|]" | while read line ; do mv "$line" "`echo "$line" | sed 's/[!|]/-/'`" ; done