Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File name is too long to delete

Status
Not open for further replies.

markofVis

Technical User
Feb 18, 2013
1
Anyone tried the Long Path Tool, can it resolve file name is too long to delete?
 
The last time I had an occurrence, I used SUBST to shorten the path.
Hmm... but what do I do if the filename is too long?
 
Yep, SUBST is one way. Telling Windows to bypass the MAX_PATH check is another.
 
Once you've sorted the long file path, if the name is too long, why not just use the old DOS name for the file to delete it

dir /X will display the shortened file/folder name to use. e.g. the My Document folder's short name comes to mydocu~1. To delete it I would use "rd /s mydocu~1
 
JustinEzequiel said:
Hmm... but what do I do if the filename is too long?
apparently, there's a hard limit of 255 chars for a filename so this is a non issue
 
>apparently, there's a hard limit of 255 chars for a filename so this is a non issue

Typically, yes.
 
apparently, there's a hard limit of 255 chars for a filename so this is a non issue"

Not sure what you a basing that on, as clearly it is...This is an age old issue, people used to get hit by all the time, just to show how old it is:


No need to shorten the name, as mentioned in a post above, just find it's shortened name in CMD prompt and delete it.

Usually these files are got by downloading via FTP / P2P sites as this don't validate the name before downloading.


Robert Wilensky:
We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true.

 
JustinEzequiel's point concerned a filename, not the total length of a full path. And for NTFS the maximum length of a filename is 255 (other file systems that Windows might be able to use may not have the same limits). There is, therefore, an API call (GetVolumeInformation) that can return, amongst other things, the the actual current maximum file name length for a specific volume. For NTFS volumes this returns 255. Guaranteed.

And I have never come across an occurrence of the 'filename too long' problem that was caused simply by the filename itself being 200 characters or more (but less than 255). It has always turned out to be caused by the fact that the full path is too long (a related error sometimes occurs if illegal - as far as Windows is concerend - characters get into the filename, as can happen if you are sharing volumes with other operating systems such as MacOS X)

>just find it's shortened name in CMD prompt

Careful. Although the default for XP is to support the creation of shortnames alongside along names it is not always guaranteed, as enterprises may elect to deactivate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top