Renaming files with date

Found a good tutorial on using Automator to rename files using the creation date. I had several photos with duplicate filenames that I wanted to use in sequence by date.

Automator Quick Action, Run Shell Script with a Workflow receives current “files or folders” in “Finder.app”

The script Shell: is bin/zsh and Pass Input: “as arguments”. The Quick Action is called RenameWithDate and is activated by right clicking on one or more filenames and choosing Quick Action in the popup menu, then selecting RenameWithDate:

for f in “$@”
do
filedate=$(date -r $(stat -f %B $f) +%Y-%m-%d);
filename=$f:t
filepath=$f:h
mv $filepath/{“$filename”,”$filedate $filename”}
done

This is a link to the YouTube video: