Has anyone seen this error? I wrote a short program to loop thru each of the specified directory and check each of the files and for some reason I got this error. Does anyone know how to handle this? I want the program skip this file name and continue with the next file. I used the DirectoryInfo class to process these files.

This exception indicates that you have made a call that requires a filepath, and you have specified one that is too long for it to handle. Can you post a short snippet of the code surrounding where the error is thrown, or the stack trace message for the error? Try printing out the fully qualified path of each file before you instantiate the DirectoryInfo class to the Console or a MessageBox.

According to this article the maximum filepath length in the Windows API is MAX_PATH (260 characters).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.