Rename files with bash and regular expressions
-
for i in *.*; do j=`echo $i | sed 's/abc_\(.*\)\.jpg/def_\1.jpg/g'`; mv "$i" "$j"; done
this example would rename the files abc_001.jpg, abc_002.jpg, ... to def_001.jpg, def_002.jpg ...
About this entry
You’re currently reading “Rename files with bash and regular expressions,” an entry on nesiumdotcom
- Published:
- 30.01.08 / 7pm
- Category:
- One-Liner
5 Comments
Jump to comment form | comments rss [?] | trackback uri [?]