Linux: Mass rename files by number and timestamp + mass edit of the last-edit date

Submitted by Peter Majmesku on Sun, 12/04/2016 - 21:26

This can be useful for masses of images editing. I needed to change the filenames of my photos to bring them in order for the popular german online print image service PosterXXL. To have all my photos ordered by specific locations, they needed ascending numeric filenames. Here I have stumbled upon useful console commands.

Rename all files to a number plus the current timestamp

ls | cat -n | while read n f; do mv "$f" "file-$(date +%s)-$n.jpg"; done

Change the last edit date of all files in a folder - not the filenames, but in the meta-information of the files

find -print | while read filename; do     touch -d "2 hours ago" "$filename"; done


Mass image rename in Linux
Subscribe to Files