How to Fix ‘File Path Too Long’ Error

7:13:00 PM | , , , , , ,


How to Fix ‘File Path Too Long’ Error While Copying, Deleting or Opening Files, Without Using Third Party Applications
Here I Fix ‘File Path Too Long’ Error While Copying, Deleting or Opening Files. ‘File Path Too Long’ Error is an error that when you try to copy something. So, it happens when you copy any file and then just try to paste it. This error stops you from the copying process and you can’t complete the process. This happens due to the pre-defined character limit and beyond this limit you cannot name any file or other stuffs. Mostly the character range is 256-260 characters. The important thing is that the character limit is for the file path and the file paths are too long if the file is too deep behind the folders and folders and hence the error occurs. Now lets see the solution to this error.

Step 1:

The first easy thing is that you just shorten the file and the folder names coming along the path to reduce the characters length.

Step 2:

Now open the command prompt and type the below command:
subst J: “the file path you want to shorten”
In above command in place of “J” you can write any drive letter.

Step 3:

Now open the J drive and just copy the data from there.
Note: Now to remove the new drive J just type subst J: /d in command prompt.
That’s it.

==================
Why does it come?
There is a pre-defined character limit beyond which you cannot name a file or folder, and it varies from one OS to another. Mostly it varies between 256 and 260 characters. This is the character limit for a file name, which excludes the file path under which it is located, like “C:\Documents and Settings\Test User\Desktop\test file.txt”. But, when you copy a file from one location, it takes into account the entire file path. So, if the file is residing under a folder which is too deep or too long, that has a length beyond the set-limit, you will get errors like the ones shown above.
How do I know that the file path length is causing the issue?
  • One way you will know is definitely from the error messages similar to the ones above which clearly mentions the problem.
  • Some other times, it won’t. You will simply get a message saying ‘Cannot Copy’ in the title.
  • Or, some other times, the files won’t open properly. They would open and close instantly without giving any errors.
  • Also when you right-click such files, the number of options available in the right-click menu would also be limited compared to other files.
Error 4
All these are caused by those incredibly long file paths.
So, how can I copy the files or fix this issue?
There are a couple of ways you can fix this easily without the use of any 3rd party applications.
  1. Check the folder path, and shorten some of the folder names in between thereby reducing the file path length. You don’t necessarily need to put the folder name as ‘Mission Impossible Three’ when you can still recognize it as ‘MI 3.’
  2. The main thing many people miss when they save a file or folder their Desktop is that the actual path to that folder in desktop is either ‘C:\Documents and Settings\%username%\Desktop’ or ‘C:\Users\%username%\Desktop’ depending on your OS. So as you can see, its already longer than you thought it is. Go to Start — Run and type ‘cmd‘ and press OK, or click start/press windows key and type ‘Command Prompt‘. Once in the command prompt window, type the following command :
subst V: “C:\TheRidiculouslyLongFolderNameWhichYouDontNeedAtAll” ,
where
subst = substitute command
V = a drive letter of my choice, you can select your own.
C:\TheRidiculouslyLongFolderNameWhichYouDontNeedAtAll = the file path you want to shorten. Change it according to your situation.
Error Fix Command
So, basically this command would convert the entire folder path you provide in the command, into a single temporary drive letter, like V in this case, which gets created in My Computer. Now all you need to do is, go to the My Computer, and open the V drive, and copy the data from there.
After the Fix to File Path Error
Note : To remove the new drive from My Computer, go to Command Prompt again and type subst V: /d