Month: April 2014

Varying “File name too long” Issues

Posted on Updated on

This question has been posed to be multiple times before, “It says the file name is too long, why can’t I delete it?” or some variation of the same issue. There is a multitude of forum postings scrawled all over the internet and it’s endless wonder telling people to go download all these programs to fix it, which either end up costing money or giving you malware and in the end they don’t even work. There are two quick and easy things to check to fix any issue pertaining to any variation of “file name too long” errors.

 

  1.  Check for Illegal Characters 

No file name, or path can have any illegal (reserved) characters which are as follows.

\ / ? : * ” > < |

If none of these exist, you’re good to move on.

 

2. ¬† Make sure the path name hasn’t exceeded the maximum length

 

Windows limits a single path to 260 characters. This is why you might get an error when copying a file with a very long file/path name to a location that has a longer path than the file’s original location. This is most often the culprit. I’ve seen it most frequently when you download some sort of compressed container or files such as a .zip or a .iso such as I’ve done here below.

 

I downloaded this .iso, and used 7zip to extract it, it then created a folder with the iso’s name then duplicated it inside of itself causing my file path to be extremely long, more than the allowed 260 maximum characters in a file path.

powershell_directory

 

 

 

When then attempting to delete the tree from C:\Users\Administrator\Downloads\ I was unable to and received the aforementioned dreaded errors.

 

too_long too_long2

 

I then went in and replaced the “en_expression_studio_4_ultimate_x86_msdnaa_dvd_537046” with just “en” and was able to dramatically reduce the file path length.

 

short_powershell

 

Now that the file path length was inside the legal character limit, I was able to successfully delete the entire tree from the C:\Users\Administrator\Downloads\ folder successfully. Bada-Bing Bada-Boom.

 

There you go. I hope I’ve made your day at least a little bit easier.