Use of quotation marks

Started by DPUK01, June 22, 2025, 07:31:51 AM

Previous topic - Next topic

DPUK01

Hello. I have found that running

1) exiftool 236 - Buddhist Monks in Kathmandu sharpened (April 1980).tif
I get zsh: no matches found: (April 1980).tif

2) but if I run
exiftool 236.tif
I get the expected results

3) Also, if I run "exiftool 236 - Buddhist Monks in Kathmandu sharpened (April 1980).tif " I get the expected results

4) If I remove the date information (this is a 35mm half frame slide so no data metadata) and run the query again I get exiftool 236 - Buddhist Monks in Kathmandu sharpened.tif
======== -

(I then have to force close the terminal window to end the process as 'exit' doesn't work)

Are there some characters in the filename that require me to use quotation marks? Also, what is the running process in example 4 that's invoked when I run the exiftool in that instance?

greybeard

Your problem is that the filename has spaces in it.

If you put the filename in quotes (not the exiftool command - just the filename) it will work:

exiftool "236 - Buddhist Monks in Kathmandu sharpened (April 1980).tif"


DPUK01

Thank you. Most of the images I have file names with spaces, so it's quotation marks that I will use.

StarGeek

Quote from: DPUK01 on June 22, 2025, 07:31:51 AM1)exiftool 236 - Buddhist Monks in Kathmandu sharpened (April 1980).tif
I get zsh: no matches found: (April 1980).tif

As @greybeard says, there are spaces in the file name. There's no way to tell that this is a single parameter and not nine separate parameters without the quotes.

When a command is entered on the command line, the command line splits everything separated by spaces into a list of separate items and passes that to exiftool in a variable called ARGV[]. All this happens before exiftool even sees anything. The result is that exiftool sees only nine separate entries (actually 10, "exiftool" itself is part of the list) and there's nothing to indicate it is a single file.

Technically, since you're not using Windows, you can also escape the spaces with a backslash. So this would also work
exiftool 236\ -\ Buddhist\ Monks\ in\ Kathmandu\ sharpened\ (April\ 1980).tif

Quote4) If I remove the date information (this is a 35mm half frame slide so no data metadata) and run the query again I get exiftool 236 - Buddhist Monks in Kathmandu sharpened.tif
======== -

(I then have to force close the terminal window to end the process as 'exit' doesn't work)

The minus sign by itself is a shortcut for STDIN. STDIN is how a program reads input from the command line. If you run a program, and it asks you some information, what you type goes into STDIN and the program can read it.

By typing a minus sign by itself, you're telling the program that more information will be coming from STDIN. And since nothing else is doing so, the program stalls.

I believe you can close STDIN and allow the program to continue by pressing Ctrl-Z and then enter.
"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

StarGeek

Here's an example of your command on Windows. Once the program hangs, I typed in "Pretend this is a text file", Enter, and then Ctrl-Z. STDIN is then closed and exiftool processes what I typed as if it were a file.

You then get error messages for all the rest of the entries.

C:\Programs\My_Stuff>exiftool 236 - Buddhist Monks in Kathmandu sharpened (April 1980).tif
======== -
Pretend this is a text file
^Z
ExifTool Version Number         : 13.31
File Size                       : 0 bytes
File Modification Date/Time     : 0000:00:00 00:00:00
File Access Date/Time           : 0000:00:00 00:00:00
File Creation Date/Time         : 0000:00:00 00:00:00
File Permissions                : c---------
File Type                       : TXT
File Type Extension             : txt
MIME Type                       : text/plain
MIME Encoding                   : us-ascii
Newlines                        : Windows CRLF
Line Count                      : 1
Word Count                      : 6
Error: File not found - 236
Error: File not found - Buddhist
Error: File not found - Monks
Error: File not found - in
Error: File not found - Kathmandu
Error: File not found - sharpened
Error: File not found - (April
Error: File not found - 1980).tif
    1 image files read
    8 files could not be read
"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

DPUK01

Thank you, Stargeek. All very useful to know and helps my growing understanding of ExifTool. There might be use case for escaping the spaces with a backslash as an alternative to parentheses but, for the moment the latter mean less typing (and so less typo risks as I learn). I will try the method you used in Windows if the process hangs again. A useful tip