Files
2024-04-02 16:15:08 +02:00

2.1 KiB

Summary

Script that can copy/hardlink photo files meeting certain criterias (e.g. minimum rating, age, and other conditions that exiftool understands) to a separate folder, maintaining the original directory structure. This is useful in situations where a photo viewing system is not capable in filtering according to the desired criteria and thus a separate mirror of the files meeting the criteria can be used instead.

Sample invocation

photos_bestof.sh --photos_dir /media/photos --best_of_dir /media/bestof_photos --min_rating 3 --max_age_days 365

Command line flags

  --min_rating:  The min rating for files to be processed (0-5). (default: 3)
  --max_age_days:  The maximum age (since the creation date) of an image to be processed. (default: -1)
  --exiftool_filter:  Only process images that satisfy the condition, which must be a string that can be evaluated by exiftool's -if statement. (default: '')
  --photos_dir:  The directory that contains the photos to be processed. (default: '')
  --bestof_dir:  The directory where the photos above --min_rating should be copied to. Path will be created if it does not exist. (default: '')
  --[no]resize:  Whether to resize the photos before copying to --resolution. (default: false)
  --resize_to:  The resolution to which to resize the photos if --resize is set. Can be anything that `convert -resize` accepts. (default: '1920')
  --[no]flatten:  Whether to flatten the directory structure to have all image files in 'best_of' directory. (default: false)
  --[no]force:  Whether to force reprocessing of all files instead of just new files. (default: false)
  --[no]prune:  Whether to remove files already existing in the bestof folder that do not meet the filter criteria. (default: false)
  --[no]use_hardlinks:  Whether to use hardlinks instead of copying. Cannot be combined with --resize. (default: false)
  --[no]verbose:  Whether to print all actions performed. (default: false)
  --[no]dry_run:  Only print what would be done but do not do anything. (default: false)
  --[no]debug:  Whether to print bash debug output. (default: false)
  -h,--[no]help:  show this help (default: false)