How to deal with files with a name longer than 259 characters?

The fileinfo class that is the standard class to use for getting fullname of a file will produce an error when the path is too long. This is a path that windows allows but the class can’t handle the error. More on the subject is described here.

After much research I installed the nuget package ZetaLong Paths. Just searched for it and chose the appropriate file as shown below.

The article that pointed me to the solution can be found here. It also lays out some alternative methods.

After I installed the package I was able to use fileinfo methods such as fullname without any path too long error. Just change fileinfo to ZpFileInfo for methods using fileinfo.

Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *

Please answer the question so the system knows your a human and not a web-bot * Time limit is exhausted. Please reload CAPTCHA.