Copy: overwrite if existing file is smaller in size

Started by annika, January 10, 2019, 04:36:03 PM

Previous topic - Next topic

annika

Hi everyone.
So I am trying to sort out my photo collection, and move certain photos (those that have specific word in Caption-Abstract IPTC tag) to a Destinational_folder
Thing is the following. I am checking various folders and subfolders. I have duplicate versions of some photos (Same filenames). However some of them are corrupted, while others are "good".

I currently use the following code (for each subfolder):
exiftool -if '$Caption-Abstract =~ /My string/i'  -q -f -o /home/user/Destinational_folder  -q -fast *
obviously when file already exists in Destinational_folder I get an error:

Error: '/home/user/Destinational_folder/filename.jpg' already exists - /home/current_folder_num/filename.jpg


However what I want to do: if the file in destinational folder is smaller in size (means corrupted) than current pic I am scanning, overwrite it. Otherwise, skip

Any suggestions? is it possible?

Phil Harvey

Sorry, this is not possible with ExifTool alone.  You would probably need to write a custom script to do this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).