Friday, August 12, 2011

Windows Explorer Path Too Long - How to Fix

I wrote this up because when I searched for a solution, all I found were people trying to sell me a fix tool for what is a very simple problem that you can fix yourself.

Symptom


Can't do anything with one or more files or folders using Windows Explorer.

Possible cause

As I understand it, modern versions of Windows allow paths up to 32000 characters, but for some reason the Windows Explorer is only able to handle 256 character paths. So it's possible to get into a situation where a program allows you to create files and folders that you can't manage later with Windows Explorer because the path is too long.

Solution

1. Use a different program to work with files. You can often do this from the File:Open dialog box of various programs.

2. Install an alternative file explorer. I didn't do this, so sorry but I can't recommend one. There is a list here.

3. Use the Subst command to create a virtual drive with a shorter path that Windows Explorer can handle, so you can fix the problem.

Subst Example

Let's say you have a file c:\very\very\long\path\file.txt that has this problem.

  1. Open a Command Prompt window (Start:All Programs:Accessories:Command Prompt)
  2. Type subst x:
  3. In Windows Explorer, browse to the file
  4. Copy perhaps half of the file path (e.g. c:\very\very) from the text box at the top
  5. Paste into the Command Prompt (right-click Paste)
You should now have the following text in your Command Prompt:

subst x: c:\very\very

Hit enter, and you should find that there is a new drive x: in your windows explorer, pointing to c:\very\very You can work with your files using this drive.

At this point it's up to you whether you use x: drive all the time to work with these files, or if you go through and shorten the names of the files and folders so that Windows Explorer can handle them from your original drive (c: in this example).

If you don't need the virtual drive any more, you can remove it with

subst x: /d

2 comments:

oscil8er said...

Nice to know there's a free tool.

oscil8er said...

Update:

The download at LongPathTool.com is now a trial only and is no longer free.

So it's back to using the solutions I described in this post.

What's more, someone tried to con me into providing a link their paid tool by claiming that the download url for LongPathTool had moved!

This is clearly a lucrative revenue source for some...