Renaming files when duplicate exist

Started by KalyaSC, January 13, 2023, 08:27:15 PM

Previous topic - Next topic

KalyaSC

Hello, thanks for your awesome software ! Probably a real noob question for most of you heavy Exiftool users, but I ran into an issue and I can't figure it out !

I'm trying to automate my image organization and while I found a solution for QuickTime file and their exif informations, I can't figure out how to change the name of a duplicate file.

exiftool -api QuickTimeUTC -r -d %Y/%B "-directory<CreateDate" .
Rather simple command but it organizes every file even image files. Probably not the most effective way, but It works !

Folder structure: Year->Month
But when exiftools encounters a duplicate name it raises an error and leaves the file untouched !

I tried to change my command so it would change the name of the duplicate as follow:

originalname-1
Without any success... Can someone please give me some clues/hints/command modification?



What I tried so far

  • Fail-retry


exiftool -api QuickTimeUTC -r -d %Y/%B "-directory<CreateDate" "-FileName<$%%f-smdsf" .

exiftool -api QuickTimeUTC -r -d %Y/%B "-directory<CreateDate" "-FileName<%f-$%C.%e" .

exiftool -api QuickTimeUTC -r -d %Y/%B "-directory<CreateDate" "-FileName<%%f%%-%C.%e" .

Way to much other exotic stuff... Changing the $ or the %, using filename, %%f or %f...


  • google and official documentation

  • Forum

Thanks :)

Phil Harvey

Try this:

exiftool -api QuickTimeUTC -r -d %Y/%B "-filename<${CreateDate}/%f%-c.%e" .

Also, you were really close with your commands, because this should also work:

exiftool -api QuickTimeUTC -r -d %Y/%B "-directory<CreateDate" "-FileName=%f%-c.%e" .

but I prefer to add the directory when writing FileName to simplify the command.  (You fell prey to common mistake 5c.)

- 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 ($).

KalyaSC

Thank youuu !!! Works like a charm !!!!! I'm really sorry I bothered you with such a simple question, I really tried, but the documentation and commands are very intimidating !

When I read through the documentation it looks wayyy out of my league... I use also an other software which can manipulate files using a YAML configuration, it's easier but limited compared to ExifTool.

If you don't mind, I'm very curious, but your piece of software is probably used in more advanced stuff like some exif-meta steganography and other more advanced stuff to manipulate invisible data ?

Also, before I dive deeper into exiftools, are the followings task possible with exiftool?

  • Using logical operators to move files e.g. move all file with no createdate tag to another folder. (not createdate)
  • Detect and move duplicate images comparing the exif data?

Thank you for your time and such a beautiful and free app  :)

Phil Harvey

Quote from: KalyaSC on January 14, 2023, 12:51:51 PMI'm very curious, but your piece of software is probably used in more advanced stuff like some exif-meta steganography and other more advanced stuff to manipulate invisible data ?

I have no idea about this.

Quote1. Using logical operators to move files e.g. move all file with no createdate tag to another folder. (not createdate)

Yes.

Quote2. Detect and move duplicate images comparing the exif data?

No.

- 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 ($).

StarGeek

Quote from: Phil Harvey on January 14, 2023, 10:29:52 PM
Quote from: KalyaSC on January 14, 2023, 12:51:51 PMI'm very curious, but your piece of software is probably used in more advanced stuff like some exif-meta steganography and other more advanced stuff to manipulate invisible data ?

I have no idea about this.

I have a IFTTT alert set up to tell me about exiftool mentions on reddit and exiftool pops up quite a bit in the various privacy, net security, and hacker subreddits with regards to steganography and hiding data. I can't remember offhand the subreddits where exiftool pops up the most, though.

Example thread I found with a quick google. 
* 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).