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 ...
this example would rename the files abc_001.jpg, abc_002.jpg, ... to def_001.jpg, def_002.jpg ...
Just a quick reminder, since I always forget this one ...
This one will keep your temporary directories clean
it recursively deletes files (not folders) older than 30 days