ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: annika on January 10, 2019, 04:36:03 PM

Title: Copy: overwrite if existing file is smaller in size
Post by: annika on January 10, 2019, 04:36:03 PM
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?
Title: Re: Copy: overwrite if existing file is smaller in size
Post by: Phil Harvey on January 10, 2019, 09:57:02 PM
Sorry, this is not possible with ExifTool alone.  You would probably need to write a custom script to do this.

- Phil