Sometimes a simple task of deleting a file or folder will turn into a challenge when working on Windows. It might give you error messages like these:

Destination Path Too Long.
 
The file name(s) would be too long for the destination folder. 
You can shorten file name and try again, or try a location that has a shorter path.

You may run into issues like these on Windows if you have too big a file name or if the file is nested deep into subfolders. The technical reason being the path including file name is longer than 255 characters. There are tools that can do the job for you, however here I present a simpler solutions invovling you to run some commands. The idea here is to create a driveletter asccociation with part of the path( keep in mind of the 255 character limit, so associate the path as deep as possible). To do this we use the subst command that comes with Windows.

  1. Fire up the commandprompt (no admin privileges needed).
  2. Use cd to navigate to the folder you want to go (you can use tab to autocomplete names)
  3. Type subst z: . to create the driveletter association. (instead of the . you can also type the entire path)
  4. Now in explorer you have a new letter. Go to it and do whatever you need to do to the with the files.
  5. Go back to your cmd window and type subst /d z: to remove the drive or alternatively, restart your pc.
“A little bit of console knowledge goes a long way.”
-Rushi
  1. Hi

    I suggest to try “Long Path Tool” program .

    before I have problem cannot delete file because file name too long. and after I found long path tool and now my problem solved 🙂

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>