Copy instead of Move, but only if the file does not exists

Started by remco, February 18, 2023, 02:56:42 PM

Previous topic - Next topic

remco

I have a few photo/video sources which need to stay as they are and will be updated when new photos are made. I want to copy these to my library, but only if the file does not exist on the destination location. Is such possible?

StarGeek

Yes.  See the second paragraph under Notes on the Writing "FileName" and "Directory" tags page, which points to Example #5.  See also the -o (-out) option.

Exiftool won't overwrite existing files, it will just give an error.

Example: I have a directory with two files, Test3.jpg and Test4.jpg.  First, I try to create a copy of test4.jpg with the same name as Test3.jpg, but this gives an error.  Then I create a copy called Test5.jpg and that succeeds.
C:\Programs\My_Stuff>exiftool -G1 -a -s -filepath Y:\!temp\aaaa
======== Y:/!temp/aaaa/Test3.jpg
[System]        FilePath                        : Y:/!temp/aaaa/Test3.jpg
======== Y:/!temp/aaaa/test4.jpg
[System]        FilePath                        : Y:/!temp/aaaa/test4.jpg
    1 directories scanned
    2 image files read

C:\Programs\My_Stuff>exiftool -o . -Filename=y:\!temp\aaaa\Test3.jpg Y:\!temp\aaaa\Test4.jpg
Error: 'y:/!temp/aaaa/Test3.jpg' already exists - Y:/!temp/aaaa/Test4.jpg
    0 image files updated
    1 files weren't updated due to errors

C:\Programs\My_Stuff>exiftool -o . -Filename=y:\!temp\aaaa\Test5.jpg Y:\!temp\aaaa\Test4.jpg
    1 image files copied

C:\>exiftool -G1 -a -s -filepath Y:\!temp\aaaa
======== Y:/!temp/aaaa/Test5.jpg
[System]        FilePath                        : Y:/!temp/aaaa/Test5.jpg
======== Y:/!temp/aaaa/Test3.jpg
[System]        FilePath                        : Y:/!temp/aaaa/Test3.jpg
======== Y:/!temp/aaaa/Test4.jpg
[System]        FilePath                        : Y:/!temp/aaaa/Test4.jpg
    1 directories scanned
    3 image files read
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).