"Sidecar" file naming conflict.

Started by skedge, November 29, 2023, 08:51:15 AM

Previous topic - Next topic

skedge

IPhone camera software has (seems like they've fixed it now) generated files numbered as IMG_nn1.jpg and if the next file (stored by the software in the same folder) were say a .MOV instead, the file would be named IMG_nn1.MOV instead of with successive numbering as IMG_nn2.MOV.   This makes a naming conflict for sidecar txt file generation,  but if the sidecars instead were named with the extension embedded as name.ext.txt, no conflict can occur.   Though they may have fixed this, I still have lots of old photos and movies that have duplicate numbering.

Thanks

StarGeek

Do you have a question about this?  I'm guessing you want something to rename the sidecars, but I'm not sure.
* 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).

skedge

FAQ 3 doesn't apply.   

Say in a folder one has two files, example1.jpg and example1.mp4. 

Drag and drop both onto exiftool.  Only one sidecar file named example1.txt is allowed.
An error is generated when exiftool encounters the existing sidecar file instead of
it overwriting the existing sidecar file.

One solution to the problem would be to name colliding file names
the same way a web browser might when one saves files from the web...
example1.txt,

and the second would be

example1(1).txt.

a third
example1(2).txt
etc


But that is not very informative.

example1.jpg.txt
example1.mp4.txt
example1.webm.txt

etc


would be better.

I'm suggesting this as an improvement to the program.

Neal Krawetz

What I'm reading is that you want a "noclobber" option that renames files uniquely if the destination name already exists.

StarGeek

Quote from: skedge on November 30, 2023, 01:58:35 AMFAQ 3 doesn't apply.

I didn't suggest it could.  You're looking at my signature text which is added to every post I make.

QuoteSay in a folder one has two files, example1.jpg and example1.mp4. 

Drag and drop both onto exiftool.  Only one sidecar file named example1.txt is allowed.
An error is generated when exiftool encounters the existing sidecar file instead of
it overwriting the existing sidecar file.

You need to show your command.  Exiftool will not create a sidecar file unless the command calls for it.  Exiftool will also not read a sidecar file associated with a file dropped on it.  It will only read the sidecar if the sidecar is dropped on it.

QuoteOne solution to the problem would be to name colliding file names
the same way a web browser might when one saves files from the web...
example1.txt,

and the second would be

example1(1).txt.

a third
example1(2).txt
etc

It sounds like you need the %c variable as detailed under the -w (-TextOut) option.

From the above docs
Quoteand %c represents a copy number which is automatically incremented if the file already exists


QuoteBut that is not very informative.

example1.jpg.txt
example1.mp4.txt
example1.webm.txt

etc

Then use the %e variable.  Assuming you're creating sidecars with a command simiar to example 13 on the Metadata Sidecar Files page, you would do this
exiftool -ext EXT -tagsfromfile @ -srcfile %d%f.%e.xmp -r DIR

But then, you are using a txt extension.  The change would be similar, but it's impossible to help troubleshoot when you don't include the command you are using
* 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).