PDF name is too long

Hello guys, has anyone been through this, or know how to solve?

Erro: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

1 Like

@Romario_Almeida,

Check these post, you may get some idea

Hey @Romario_Almeida yeah, you’ll need to save your PDF in a different location or shorten the PDF name. The problem here is that your full file path (C:\Users<Name.Surname>…\Document1.pdf) exceeds 248 characters. So if you can remove 12 characters from your filename then that would be first prize, else, try saving it somewhere else.

Hope this helps!

@Romario_Almeida

Hello Romario,

a very interesting challenge. As far as I understand this document about paths correct, are the restrictions with version 1607 finished. I tried that with version1909, but without success.

Then I tried it with short and long path names, e.g.
C:\Dummy\DIESIS~1\DIESIS~1\UNDNOC~1\ABCDEF~1\ABCDEF~1\ABCDEF~1\ABCDEF~1\Test\DIESIS~1\Test.txt
instead
C:\Dummy\Dies ist ein Test\Dies ist ein Test für lange lange Verzeichnisnamen\Und noch länger soll es werden mal schauen wie es damit funktioniert\abc def ghi jklmnop qrstuvwxyz\abc def ghi jklmnop qrstuvwxyz\abc def ghi jklmnop qrstuvwxyz\abc def ghi jklmnop qrstuvwxyz\Test\Dies ist wieder ein Test\Test.txt
but also without success. It seems that dotNET the short path names resolves to long path names. You can see here that the name of each folder is shortened to 8 characters, from “Dies ist ein Test” to “DIESIS~1”.

Here now a tiny experimental library to handle path lengths until 32767 characters.

GetPathName.1.0.0.nupkg (5.9 KB)

Only three functions:

image

Get Long Path Name
Converts a path from short to long form.

Get Short Path Name
Converts a path from long to short form.

Copy File
Copies a file from source to destination.
With this method you can copy your file in a folder which length is < 260, to handle it.

All activities bases on Win32 API.

Best regards
Stefan

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.