Author Topic: detect if "already exists" are true copies and delete or rename source file ?  (Read 2811 times)

maxandersen

  • Newbie
  • *
  • Posts: 2
Hi,

I'm loving exiftool helping me to clean up my way too many photos into year/month/day folders.

Current command i'm going around running in my various folders are:
 
sudo exiftool -v -r -d '/volume1/photo/sorted/big_camera/%Y/%m-%b/%d'  "-directory<CreateDate" "-directory<DateTimeOriginal" "-directory<FileModifyDate" .

I got a challenge though - over the years I ended up with copies of same photo and thus I got a lot of
"x already exists - y" errors.

Is there a flag or some awesome trick to have exiftool check if the file are an actual identical file and then rename or even remove the source file ?

Trying to not have to run additional scripts to verify the files are true duplicates.

Any tips appreciated!
/max

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
Hi Max.

ExifTool deals with one file at a time, so you need to find some other way to compare two files to see if they are the same.

You can also move the duplicates by doing this:

exiftool -v -r -d '/volume1/photo/sorted/big_camera/%Y/%m-%b/%d/%%f%%-c.%%e'  "-filename<CreateDate" "-filename<DateTimeOriginal" "-filename<FileModifyDate" .

This will add a "-1", "-2" etc to the names of duplicate files.

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

maxandersen

  • Newbie
  • *
  • Posts: 2
I tried playing with -c but no luck.

With your command it seem to created nested folders...

Setting new values from IMG_9050.JPG
'IMG_9050.JPG' --> '/Volumes/photo/sorted/lisbeth_phone/2016/03-Mar/29/IMG_9050.JPG/IMG_9050.JPG'
Error creating directory /Volumes/photo/sorted/lisbeth_phone/2016/03-Mar/29/IMG_9050.JPG
Warning = Error creating directory for '/Volumes/photo/sorted/lisbeth_phone/2016/03-Mar[snip]
Warning: Error creating directory for '/Volumes/photo/sorted/lisbeth_phone/2016/03-Mar/29/IMG_9050.JPG/IMG_9050.JPG' - IMG_9050.JPG

any idea what might be wrong ?

Hayo Baan

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 1140
  • Professional Photographer & Software Developer
    • Hayo Baan – Photography
I think Phil made a typo. Try it with %%-c replaced with -%%c.
Also make sure the directory base /Volumes/photo... is correct and is writeable by you.
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
I think Phil made a typo. Try it with %%-c replaced with -%%c.

No typo this time:

            For %c, these modifiers have a different effects.  If a field
            width is given, the copy number is padded with zeros to the
            specified width.  A leading '-' adds a dash before the copy
            number
, and a '+' adds an underline.  By default, the copy number
            is omitted from the first file of a given name, but this can be
            changed by adding a decimal point to the modifier.  For example:

                -w A%-cZ.txt      # AZ.txt, A-1Z.txt, A-2Z.txt ...


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

Hayo Baan

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 1140
  • Professional Photographer & Software Developer
    • Hayo Baan – Photography
Thanks Phil for enlightening me, there are just so many features. Always good to learn even more ;D

So that was definitely not it then, so perhaps still something with the paths and/or permissions.
Hayo Baan – Photography
Web: www.hayobaan.nl

BangkokPhoto

  • Jr. Member
  • **
  • Posts: 26
I had a similar problem. DoubleKiller from bigbangenterprises worked well.

http://www.bigbangenterprises.de/en/doublekiller/