Exiftool from a list of files: error message because of spaces in filename?

Started by sylf, July 19, 2023, 09:27:53 AM

Previous topic - Next topic

sylf

Hello.
I am using Exiftool 12.63 on Windows 10. Following command works (there is a result):
exiftool "my_path\_recette nov 2.mp4"Following command does not work ("Error: File not found - _recette nov 2.mp4"):
exiftool -@ my_path\text_file_including_mp4_file_path.txtMy guess: it is a spaces-in-filename problem. In my txt file, I tried these two forms:
"my_path\_recette nov 2.mp4"
my_path\_recette nov 2.mp4
Both of them lead to the same error message.
Thank you in advance for your help.
S




StarGeek

This is a property of the command line.  Spaces are used to separate command line arguments and when you use a file path with a space, there's no way for the command line to know that you actually mean you are passing a single argument.  The same thing will happen if you try to write data that contains a space in it.  There's no way to know where the data ends and where a new option begins.

On Windows CMD, you need to put double quotes around any argument with a space.  On Mac/Linux, you can use double or single quotes as long as the argument doesn't contain a dollar sign, then you must use single quotes.

I have no idea with regards to Windows Powershell, it has far too many idiosyncrasies that set it apart from every other command line.  It's best to use CMD when using exiftool.

Quote from: sylf on July 19, 2023, 09:27:53 AMIn my txt file, I tried these two forms:
"my_path\_recette nov 2.mp4"
my_path\_recette nov 2.mp4
Both of them lead to the same error message.

See FAQ #29.  In an ARGS file, you don't use quotes and don't need to escape anything.  Exiftool is reading the ARGS file directly without the command line altering anything.  As long as the path was accurate, the second option should have worked.

Example, without quotes, the command line (not exiftool) broke the file path into 6 separate arguments, leading to 6 failures
C:\>exiftool -G1 -a -s -AllDates Y:\!temp\ddd\New Folder With Items\_recette nov 2.mp4
Error: File not found - Y:/!temp/ddd/New
Error: File not found - Folder
Error: File not found - With
Error: File not found - Items/_recette
Error: File not found - nov
Error: File not found - 2.mp4
    0 image files read
    6 files could not be read

On the command line with quotes
C:\>exiftool -G1 -a -s -AllDates "Y:\!temp\ddd\New Folder With Items\_recette nov 2.mp4"
[QuickTime]     CreateDate                      : 1982:02:02 05:20:59
[QuickTime]     ModifyDate                      : 2019:08:29 08:16:19

Using an ARGS file. The one with quotes fails, but the one without succeeds
C:\>type "Y:\!temp\ddd\New Folder With Items\Args file with spaces.txt"
"Y:\!temp\ddd\New Folder With Items\_recette nov 2.mp4"
Y:\!temp\ddd\New Folder With Items\_recette nov 2.mp4
C:\>exiftool -G1 -a -s -AllDates -@ "Y:\!temp\ddd\New Folder With Items\Args file with spaces.txt"
Error: File not found - "Y:/!temp/ddd/New Folder With Items/_recette nov 2.mp4"
======== Y:/!temp/ddd/New Folder With Items/_recette nov 2.mp4
[QuickTime]     CreateDate                      : 1982:02:02 05:20:59
[QuickTime]     ModifyDate                      : 2019:08:29 08:16:19
    1 image files read
    1 files could not be read
* 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).

sylf

Thank you, Stargeek, for the useful explanations.
From them I deduce that the cause of my problem is not the spaces in the filename.
What possible cause should I consider?
My next guess is the following:
Windows Explorer considers _recette nov 2.mp4 as a hidden file: by default, this file does not appear in the Windows Explorer. Maybe, Exiftool does not find this file because of that.
Is this plausible and is there a way to escape?
Your help would be much appreciated.

StarGeek

Quote from: sylf on July 19, 2023, 12:18:12 PMWindows Explorer considers _recette nov 2.mp4 as a hidden file: by default, this file does not appear in the Windows Explorer. Maybe, Exiftool does not find this file because of that.

I'm not sure.  As shown above, it doesn't happen on my Win10 system.

Try drag/dropping the file onto the command line, making sure there's a space before and after the drop


That should give the exact file path on the command line.  If exiftool can't read it like that, I don't know what the problem might be.
* 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).