Thursday, March 04, 2010

Linux: Rename Multiple Files with Date

You want to rename multiple files by putting the modified date of each file in its name?  Me too, all the time.  Here's what I put together to do just that (and am blogging it for reference):

for w in *.jpeg; do mv $w `date +"%Y%m%d"`-$w; done
This changes the filename of all files ending with ".jpeg" and prefixes them with a YYYYMMDD timestamp followed by a dash.

0 comments: