ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: webazubi on March 01, 2018, 07:34:59 PM

Title: Files in Batch Loop where updated too often
Post by: webazubi on March 01, 2018, 07:34:59 PM
Hello.
Can you give me a tip for my batch file, which works fine, but maybe it could't run quicker?

In my Photoprogram "ThumbsPlus" I select some photos and give the names of the photos to my batch file.

The batch makes this:
@for %%i in (%*) do (exiftool -overwrite_original -codedcharacterset= %* -rating=1  %%i)

If I select just one Photo, then the output in DOS-Prompt is:

C:\Fotos>(exiftool -overwrite_original -codedcharacterset= "C:\Fotos\test01.JPG" -rating=1  "C:\Fotos\test01.JPG" )
    2 image files updated


Why is the output "2 image files updated", when I just selected only one file?


If I take 2 Photos, here is the output:

C:\Fotos>(exiftool -overwrite_original -codedcharacterset= "C:\Fotos\test01.JPG" "C:\Fotos\test03.JPG" -rating=1  "C:\Fotos\test01.JPG" )
    3 image files updated
C:\Fotos>(exiftool -overwrite_original -codedcharacterset= "C:\Fotos\test01.JPG" "C:\Fotos\test03.JPG" -rating=1  "C:\Fotos\test03.JPG" )
    3 image files updated


And last example with 4 photos:

C:\Fotos>(exiftool -overwrite_original -codedcharacterset= "C:\Fotos\test01.JPG" "C:\Fotos\test03.JPG" "C:\Fotos\test05.JPG" "C:\Fotos\test06.JPG" -rating=1  "C:\Fotos\test01.JPG" )
    5 image files updated

C:\Fotos>(exiftool -overwrite_original -codedcharacterset= "C:\Fotos\test01.JPG" "C:\Fotos\test03.JPG" "C:\Fotos\test05.JPG" "C:\Fotos\test06.JPG" -rating=1  "C:\Fotos\test03.JPG" )
    5 image files updated

C:\Fotos>(exiftool -overwrite_original -codedcharacterset= "C:\Fotos\test01.JPG" "C:\Fotos\test03.JPG" "C:\Fotos\test05.JPG" "C:\Fotos\test06.JPG" -rating=1  "C:\Fotos\test05.JPG" )
    5 image files updated

C:\Fotos>(exiftool -overwrite_original -codedcharacterset= "C:\Fotos\test01.JPG" "C:\Fotos\test03.JPG" "C:\Fotos\test05.JPG" "C:\Fotos\test06.JPG" -rating=1  "C:\Fotos\test06.JPG" )
    5 image files updated



Does the batch update really 20 files (in the last example - 5 Files in 4 loops)???
How can I speed up the batch?

Thanks and sorry for my englisch
Title: Re: Files in Batch Loop where updated too often
Post by: StarGeek on March 01, 2018, 08:02:48 PM
Quote from: webazubi on March 01, 2018, 07:34:59 PM
If I select just one Photo, then the output in DOS-Prompt is:

C:\Fotos>(exiftool -overwrite_original -codedcharacterset= "C:\Fotos\test01.JPG" -rating=1  "C:\Fotos\test01.JPG" )
    2 image files updated


Why is the output "2 image files updated", when I just selected only one file?

Because you're sending the same file to the command line twice, so it gets processed twice.

You're passing %* to the command which is all of the arguments to the batch file.  Your loop also parses %* for each argument, saves the value in the %i variable and adds that to the end of the command. 

I would suggest skipping the loop and just passing the file list all at once.  Something like:
exiftool -overwrite_original -codedcharacterset= -rating=1 %*

The only problem would come when you pass too many files and exceed the maximum length of Windows command line, which is a bit above 8,000 characters. 

Title: Re: Files in Batch Loop where updated too often
Post by: webazubi on March 01, 2018, 09:12:13 PM
Thank you!
The batch runs now more faster without the loop.

>length of Windows command line
Yes I know the problem. If I give 100 photo-Names to the batch, than it breaks down.
Maybe exporting the file-names to a txt-file that exifftool can import is the safer way.