Batch processing of files with the same name but not the same extension

Started by sylf, February 02, 2024, 11:03:21 AM

Previous topic - Next topic

sylf

Hello.
I have a text file with hundreds of lines. Each line is the full path of a file to be processed by this ExifTool command:
exiftool -@ path1\file_list.txt -X -w path2\%d%f.xmlOften, in an input folder, I have files with the same name but not the same extension. Example: test1.jpg and test1.tif.
In these cases, ExifTool processes only one of the files and I get only one xml file as output. Of course, I need one xml file per input file.
What would be the way to reach my goal?
Kind regards.


StarGeek

How do you want to name the duplicate XML files?  Obviously, you can't have two XML files with the same name for each of the test1.jpg/test1.tif.

You might change the XML file name to include the extension.
exiftool -@ path1\file_list.txt -X -w path2\%d%f.%e.xml

You could also use a copy number %c instead of the extension %e but then you don't have a way to tell which XML file belongs to the tiff or the jpg.

See the -w (-TextOut) option for details on the percent variables.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

sylf

Thank you StarGeek!
In case this might be useful to someone. In the command:
exiftool -@ path1\file_list.txt -X -w path2\%d%f%+c.xmland precisely in "%+c", "+" adds an underscore before the copy number. Output will be: "test1.xml" and "test1_1.xml".
But I think you are right, StarGeek, adding the extension is a good idea.
You are proposing this output: "test1.jpg.xml" and "test1.tif.xml". But I have some superstition that prevents me from putting a dot in filenames except before the extension, of course. Do you have any religion on the subject? Personally, I am used to insert "_" as a separator.

Phil Harvey

If you don't want 2 dots in teh name, you could do this:

-w path2\%d%f_%e.xml

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

sylf

Thank you, Phil.
If you or anyone here would like to comment my superstition of not putting dots in filenames, I would be interested.

Phil Harvey

Multiple dots in filenames are fairly common nowadays.  I haven't had any problems with it, but I'm on a Mac and things may be different for Windows.

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

sylf

Thank you again, Phil.
Windows and Linux Users: any comments on the use of dots in filenames are welcome here. Although I admit that it is not an ExifTool issue.