Move the .sh
file into the folder containing the files to be sorted. Navigate to the folder using Terminal.
Run shell script:
sh sort-by-created.sh
Or directly in Terminal:
for f in *; do
dir=$(stat -f%SB -t%Y-%m-%d "$f")
echo $f '->' $dir
[ -d "$dir" ] || mkdir "$dir"
mv "$f" "$dir"/
done
Run shell script:
sh sort-by-modified.sh
Or directly in Terminal:
for f in *; do
dir=$(stat -f%Sm -t%Y-%m-%d "$f")
echo $f '->' $dir
[ -d "$dir" ] || mkdir "$dir"
mv "$f" "$dir"/
done
Install exiftool
Run shell script:
sh sort-by-exif.sh
Or directly in Terminal:
exiftool -d %Y-%m-%d "-directory<datetimeoriginal" $PWD