petrichor (/'pe - tri - kor'/) is the familiar scent of rain on dry earth this tech blog is the wafting fragrance of my geeky outpourings, one post at a time
Monday, August 3, 2009
linux: rename multiple files with one command
We're going to do this simple task with a simple regex find+replace in sed:
for i in *.avi
do
j=`echo $i | sed 's/mymovies/myflicks/g'`
mv "$i" "$j"
done
Can also be written on a single line as:
for i in *.avi; do j=`echo $i | sed 's/find/replace/g'`; mv "$i" "$j"; done
No comments:
Post a Comment