Saturday, May 16, 2009

the file name you specified is not valid or too long

I was installing a Visual Studio project made by a very cool team and, as they are very cool, it had this very complex folder structure for every little class and test and long names on the folder and so on and so on. Therefore, when trying to create a file on my Windows XP computer, the installer of the project failed with the strange error: 'the file name you specified is not valid or too long'.

I was under the impression that the path was no longer limited to 255 characters in Windows XP, but I was wrong. The MAX_PATH constant in Windows XP is 260. Everything over that causes an error unless specifically using a UNC formatted path (starting with \\?\). Weird huh?

Here is a technical description of the path concept in Windows: File Names, Paths, and Namespaces.
And here is the KB article with the "solutions": You cannot delete a file or a folder on an NTFS file system volume.


Anonymous said...

Hello guys,

Do you encounter errors while deleting files in Windows? I'm here to provide a solution. I've been reading several threads on this topic on different forums where computer users were asking about this popular error "The filename you specified is not valid or too long".

My research helped me to find a tool for you guys.

Its LONG PATH TOOL, a very easy to run but highly powerful software.

Follow the link to read more about this error.

Siderite said...

Hmm, I almost deleted this as spam, but then I noticed that you mention FAR on your site. You can't be a bad hacker, then! ;)

How about patching FAR Manager to allow for long paths? You would have my undying respect for that.

Neng Silvi said...

Long path tool is the best solution for your problem. try it and solve your problem.

garry dam said...

Try and download " Long Path Tool " is also useful in situations where you see these error messages: Cannot read from source file or disk, there has been a sharing violation, cannot delete file or folder, the file name you specified is not valid or too long, the source or destination file may be in use and many other file managing errors.