Is there an app on OS X that can sort through all your photos within a folder and organize them into folders and name each folder the date it was taken.
2 Answers
Here's a bash script that sorts files into year/month/day/ directory paths.
#!/bin/bash
dir=/path/to/directory
find "$dir" -maxdepth 1 -type f | while IFS= read -r file; do
year=$(stat -f "%Sm" -t "%y" $file)
month=$(stat -f "%Sm" -t "%m" $file)
day=$(stat -f "%Sm" -t "%d" $file)
[[ ! -d "$dir/$year/$month/$day" ]] && mkdir -p "$dir/$year/$month/$day";
mv "$file" "$dir/$year/$month/$day"
done
Untested, have backups, etc
Save the script as something.sh, change the second line of the script to the path that you want to sort the contents of, then run chmod u+x /path/to/file.sh && /path/to/file.sh. However, if you are unfamiliar with shell scripts I wouldn't recommend this hacked-together, untested script that I wrote late at night be the very first script you run!
-
-
Save the script as
something.sh, change the second line of the script to the path that you want to sort the contents of, then runchmod u+x /path/to/file.sh && /path/to/file.sh. However, if you are unfamiliar with shell scripts I wouldn't recommend this hacked-together, untested script that I wrote late at night be the very first script you run :)– grg ♦Aug 30, 2014 at 21:08 -
1This is using the filesystem timestamp - depending on the files, might be worth checking the EXIF data (if it's available) using something like ExifTool. You could have the script check Exif and use that, then fall back to the filesystem data, or log differences.– AlexAug 31, 2014 at 1:53
-
@Alex This was never meant to be a finished, canonical do-all script. I'm against writing entire scripts for answers—I just happened to have this script already written and the answer wasn't asking for a script but an app.– grg ♦Aug 31, 2014 at 8:58
-
Aperture can import images and have them sorted by date but you end up with projects inside Aperture (the project names are the dates the photos were taken). Make sure the Preferences » Import settings are set to split import into "One Project Per Day". If you don't want to keep them in Aperture, you can easily export them back out into folders.