ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: antkent on January 07, 2021, 09:38:53 PM

Title: Space in Directory name = file not found for some operations
Post by: antkent on January 07, 2021, 09:38:53 PM
Most operations work when there is a space in the target Directory name, but results in "file not found" for some (but not all) operations

Example: exiftool -L -d %Y "-rights<©$DateTimeOriginal, First Last. All Rights Reserved." -r C:\Motorsports\2003\ChampCar\St Pete

Result: Error: File not found - C:/Motorsports/2003/ChampCar/St

Not sure if this is an OS issue, but seems like it should not be.
Title: Re: Space in Directory name = file not found for some operations
Post by: Phil Harvey on January 07, 2021, 09:49:23 PM
You need quotes around any command-line argument that contains spaces.

- Phil
Title: Re: Space in Directory name = file not found for some operations
Post by: Alan Clifford on January 08, 2021, 03:00:56 PM
QuoteC:\Motorsports\2003\ChampCar\St Pete

How do you expect the operating system to know that that is an entity called "St Pete", rather than two entities called "St" and "Pete" when the operating system uses the space character to keep such entities separate?
Title: Re: Space in Directory name = file not found for some operations
Post by: StarGeek on January 08, 2021, 03:45:08 PM
This is standard among all types of command line.
Title: Re: Space in Directory name = file not found for some operations
Post by: jeff_k on January 08, 2022, 01:45:10 PM
Oddly, I am still seeing this error even when quoting the directory path.

Command:
exiftool -@ ~/vsco_exif.txt

Contents of vsco_exif.txt:
-r
-d
%Y-%m/%Y-%m-%d at %H-%M-%S
-filename<$createdate - Unknown%-c.%e
-filename<$createdate - ${model;s/\//-/}%-c.%e
-filename<$datetimeoriginal - Unknown%-c.%e
-filename<$datetimeoriginal - ${model;s/\//-/}%-c.%e
-filename<$datetimeoriginal.${subsectimeoriginal;$_='0'x(3-length).$_} - Unknown%-c.%e
-filename<$datetimeoriginal.${subsectimeoriginal;$_='0'x(3-length).$_} - ${model;s/\//-/}%-c.%e
"/volume1/gen testing/vsco_testing/"


Results:
Warning: Error opening file - "/volume1/gen testing/vsco_testing/"
Error: File not found - "/volume1/gen testing/vsco_testing/"
    0 image files updated
    1 files weren't updated due to errors


Am I missing something?
Title: Re: Space in Directory name = file not found for some operations
Post by: StarGeek on January 08, 2022, 03:36:05 PM
FAQ #29 (https://exiftool.org/faq.html#Q29) applies here.
Title: Re: Space in Directory name = file not found for some operations
Post by: jeff_k on January 08, 2022, 05:10:29 PM
Thank you...I should've mentioned: I had already included it without the quotes and with \ to escape the space in the directory name, but I still got file not found.
(i.e. I used /volume1/gen\ testing/vsco_testing/ without any quotes but still got the same error message)

Title: Re: Space in Directory name = file not found for some operations
Post by: StarGeek on January 08, 2022, 05:23:07 PM
Escaping spaces is part of shell.  You do not use quotes nor do you escape any characters in an arg file.
/volume1/gen testing/vsco_testing/

Edit: From the docs on the -@ (Argfile) option (https://exiftool.org/exiftool_pod.html#ARGFILE)
     Normal shell processing of arguments is not performed, which among other things means that arguments should not be quoted and spaces are treated as any other character
Title: Re: Space in Directory name = file not found for some operations
Post by: jeff_k on January 08, 2022, 05:34:14 PM
 ::) oh for Pete's sake. Thank you!