FlipsideReality Once upon a time, in a land far far away…

23May/070

Batch renaming of files by extension (bash)

OK, lots of links on google, but none for doing what i want. I need to move some files like so '12%2012%20EE' >>> '12 12 EE' but i ended up ls > files.txt and editing a script in excel... Not very professoinal.

I subsequently found this:

# change .htm files to .htmlfor file in *.htm ; do mv $file `echo $file | sed 's/\(.*\.\)htm/\1html/'` ; done

# change .html files to .htmfor file in *.html ; do mv $file `echo $file | sed 's/\(.*\.\)html/\1htm/'` ; done

#change .html files to .shtmlfor file in *.html ; do mv $file `echo $file | sed 's/\(.*\.\)html/\1shtml/'` ; done

#change .html files to phpfor file in *.html ; do mv $file `echo $file | sed 's/\(.*\.\)html/\1php/'` ; done
  

  or:

for i in * ; domv \"$i\" \"$i.mp3\"done

But i'm still not happy :-(

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.