Main Menu

Long path names

Started by Alyssa, August 12, 2023, 04:46:53 AM

Previous topic - Next topic

Alyssa

Hello

Seems like even with Long Paths enabled in Windows 10 Exiftool isn't able to open files with more than 220-ish characters in total (including the path).

The only workaround I know is to simple move files to a shorter path in the root folder of the drive;

I even made a Power Shell script that creates a short-named folder in its current drive, move the files there, activate the script I need, then move the files back where they were and deletes the short-named folder created, but there has to be a simpler way to do this...?


Phil Harvey

There is a command-line length limitation in Windows.  You can use the -@ feature and put the file names in the argfile to get around this.

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

obetz

Quote from: Phil Harvey on August 12, 2023, 06:54:03 AMThere is a command-line length limitation in Windows.

even with short command lines, exiftool doesn't seem to be able to deal with long paths.

I tried
exiftool -filename -ext jpg -r . with two jpg files in a 200 char directory, on of them with a short filename and one with a long filename.

Result
File Name                       : short.jpg
    2 directories scanned
    1 image files read
    1 files could not be read

See also https://exiftool.org/forum/index.php?topic=11539 from 2020-08-13 confirming that Perl for Windows doesn't support long path names out of the box.

OTOH, not even Windows Explorer is able to deal with long path names. You need a 3rd party file manager to access such files interactively!

I'm not sure whether it is a good idea to use yet another library to circumvent this, although Win32::LongPath looks reasonably maintained.

New Perl versions could break it, see https://github.com/rdboisvert/Win32-LongPath/issues for a report about possible errors with latest Strawberry Perl.

And we would need new tests.