0

Starting with find and rsync? and How to rsync files / folders from a specific date forward?, how to rsync photos from a specific date, namely from the date on which the photo was taken (i.e., from the photo's meta data, i.e. EXIF, e.g., exif:DateTime, which may well differ from the file's "last modified date") forward?

One idea would be to make use of identify -verbose IMG_20200430_113445.jpg | grep -i date and exif:DateTime within, another would be to use exiftool (https://stackoverflow.com/questions/48582185/only-get-datetimeoriginal-with-exiftool) for that. Maybe this and elements of the two Q&A's quoted above would work?


That is, combining the ideas from the two above quoted Q&A's (and perhaps also this one) with this

identify -verbose IMG_20200430_113445.jpg | grep -i date, returning exif:DateTime

or this

exiftool -DateTimeOriginal IMG_20200430_113445.jpg

might be "the" way...


See also:

2 Answers2

1

This is the command I used to copy my 2022 files to my photo subdirectory. Iphone mounted at /mnt/iPhone and files are in /DCIM/103APPLE Destination is my photos, with different folders for each year.

find /mnt/iPhone/DCIM/103APPLE -name "*.*" -newermt "2022-01-01" ! -newermt "2023-01-01"  -print0 | rsync -aruvlP /mnt/iPhone/DCIM/103APPLE/  /mnt/data/Pictures/All2022/Fred/103APPLE

I do not normally use second date as year to date.

find /mnt/iPhone/DCIM/103APPLE -name "*.*" -newermt "2023-01-01 00:00:00" -print0 | rsync -aruvlP /mnt/iPhone/DCIM/103APPLE/  /mnt/data/Pictures/All2023/Fred/103APPLE
oldfred
  • 12,100
  • That's what the two quoted Q&A's already cover; but I'm not after the newermt, but rather the date the photo was taken, which may well be different. – nutty about natty Feb 20 '23 at 17:46
0

Backup photos (*.jpg's) shot after a certain date

The following approach uses rsync and exiftool (and not find and identify).

Filter

To get a first idea of the number of files which meet the filter's criteria one may start off with

exiftool -progress -if '$DateTimeOriginal ge "2012:01:01"' -p '$FileName' *.jpg

Dry-run

Next, one may do a "dry run", to see what would be copied in the next step, with

rsync -n -aPh --ignore-existing --stats --info=progress2 --files-from=<(exiftool -if '$DateTimeOriginal ge "2015:01:01"' -p '$FileName' *.jpg) /source/ /dest/

Sync

Finally, one may perform the actual "copy" operation, by removing -n from the above line, like so:

rsync -aPh --ignore-existing --stats --info=progress2 --files-from=<(exiftool -if '$DateTimeOriginal ge "2015:01:01"' -p '$FileName' *.jpg) /source/ /dest/

Related links: