This script will scan multiple directories and hash them to identify multiple copies of the same file. It will also read in EXIF data from the picture as well to get the time the picture was taken.
It can then build a hardlink directory structure to centralize these disparate directories into one location.
- Ruby 3 installed
- bundler installed
- Run
bundle
Suppose I have three directories of photos:
- /home/user1/Pictures/
- /home/share/Pictures/
- /home/user3/Photos Library.photoslibrary/originals
These directories may or may not have the exact same photos. Create a directory structure with a set of hard links based on the EXIF dates:
bundle exec ruby backupPhotos.rb -d /home/user1/Pictures/ -d /home/share/Pictures/ -d /home/user3/Photos\ Library.photoslibrary/originals -o /home/share/bydate