Directory/folder name problems

Started by BrooksR, June 01, 2025, 02:51:20 PM

Previous topic - Next topic

BrooksR

When I run the exiftool from the cmd line (see below), I have 3 problems with the directory column that it creates:

1.   Slashes in the directory names are / instead of \. 

2.   Spaces in the directory names should be ASCII 32 and instead they are ASCII 160 (non-breaking spaces?).

3.   It is returning strange Unicode characters in some cases, usually where there would be a space.  Like:  Waitemata┬áand┬áGulf┬áWard

These character problems do not exist when viewing the directories with Windows File Manager or when using VBA code like: Set fso = CreateObject("Scripting.FileSystemObject")

Exiftool is doing something to create these characters.  I added "exit=utf8" but it did not help.  Any assistance appreciated.

exiftool -r -ext jpg -csv -filename -filemodifydate -datetimeoriginal -charset exif=utf8 -directory -IPTC:ObjectName -IPTC:Category -IPTC:Keywords -IPTC:City -IPTC:Sublocation -IPTC:Province-State -IPTC:Caption-Abstract -GPSLatitude -GPSLongitude D:\C4 >output.csv

Phil Harvey

Quote from: BrooksR on June 01, 2025, 02:51:20 PM1.   Slashes in the directory names are / instead of \. 

You can change all forward slashes to backslashes by adding -api filter="tr(/)(\\)" to the command (but of course this will change slashes in other tags too).

Quote2.   Spaces in the directory names should be ASCII 32 and instead they are ASCII 160 (non-breaking spaces?).

I don't see how ExifTool could be doing this.

Quote3.   It is returning strange Unicode characters in some cases, usually where there would be a space.  Like:  Waitemata┬áand┬áGulf┬áWard

These character problems do not exist when viewing the directories with Windows File Manager or when using VBA code like: Set fso = CreateObject("Scripting.FileSystemObject")

Exiftool is doing something to create these characters.  I added "exit=utf8" but it did not help.  Any assistance appreciated.

exiftool -r -ext jpg -csv -filename -filemodifydate -datetimeoriginal -charset exif=utf8 -directory -IPTC:ObjectName -IPTC:Category -IPTC:Keywords -IPTC:City -IPTC:Sublocation -IPTC:Province-State -IPTC:Caption-Abstract -GPSLatitude -GPSLongitude D:\C4 >output.csv

Your "-charset exif=utf8" has no effect because you are not extracting any EXIF tags (other than the GPS tags). 

Have you read FAQ 10 and FAQ 18?

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

StarGeek

Quote from: BrooksR on June 01, 2025, 02:51:20 PM2.    Spaces in the directory names should be ASCII 32 and instead they are ASCII 160 (non-breaking spaces?).

As Phil says, it isn't exiftool doing this.

Check you directory names to make sure the directories themselves don't have non-break spaces instead of spaces.

Are you using PowerShell or CMD? Make sure and use CMD, as PS tries to convert everything into UTF-16 when it is redirected/piped.

Make sure you're not loading the text into a word processor/Google Docs/etc. Programs like these will "help" you by converting some characters into others, with quotes being a big example of this.
"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

BrooksR

Thank you for the reply, Phil.

[I don't see how ExifTool could be doing this.]

It could be coming from the Apple iPhone that way.

[{Have you read FAQ 10 and FAQ 18?]

There is an overwhelming amount of information there.  :) Prior to running exiftool, I'm moving the JPGs from an iPhone to a PC using a utility called iMazing.  When I talk to them about these problems, they say they are just bringing the data over as it sits in the iPhone Photos area. 

Could you please suggest what parameter(s) I should try?  Thanks!


BrooksR

Quote from: StarGeek on June 01, 2025, 04:48:16 PM
Quote from: BrooksR on June 01, 2025, 02:51:20 PM2.    Spaces in the directory names should be ASCII 32 and instead they are ASCII 160 (non-breaking spaces?).

As Phil says, it isn't exiftool doing this.

Check you directory names to make sure the directories themselves don't have non-break spaces instead of spaces.

Are you using PowerShell or CMD? Make sure and use CMD, as PS tries to convert everything into UTF-16 when it is redirected/piped.

Make sure you're not loading the text into a word processor/Google Docs/etc. Programs like these will "help" you by converting some characters into others, with quotes being a big example of this.

Checking the directory names is a good idea (I should have thought of that).

Everything is CMD. 

No, not using a Word Processor. But the data is coming from an iPhone.  I don't see special characters when I use File Manager to view the folders on the PC.  They show up when I run exiftool.exe and output to the CSV. 

StarGeek

Quote from: BrooksR on June 02, 2025, 04:21:52 PMI don't see special characters when I use File Manager to view the folders on the PC.  They show up when I run exiftool.exe and output to the CSV. 

They won't necessarily show up when you just look at the directory name.

Try selecting the problem directory, hit F2, hit Control+C. That will copy the directory name to the clipboard.

Then paste the results into this website (InvisibleCharacterViewer). If nonbreak space characters are part of the directory name, then they will show up in the second text box.
"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