Most of the user might experience this error(Source path too Long) while trying to delete or copy the files. The windows will prompt the following error message.
- “Error cannot delete file: cannot read from source file or disk”
- “Source path too Long”
- “Cannot delete file or folder The file name you specified is not valid or too long. Specify a different file name.”
- “Cannot remove folder – the filename or extension is too long”
- “File name too long”
So why its occurs?
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 (Source path Long) like the ones shown above.
Resolution 1: Rename or move a folder with a path that is too long
To work around this problem, rename the folder so that the files that exceed the MAX_PATH limit no longer exist. In this case, start from the root folder or any other point, then rename the folders to abbreviate their names. If this is not sufficient to solve the problem, for example, if a file is located at a depth greater than 128 folders, go to Resolution 3.
Resolution 2: Use a network share whose depth is equal to that of the folder
If Resolution 1 is not workable or does not solve the problem, create a network share at the maximum possible depth in the folder structure, then rename the folders by accessing the share.
Resolution 3: use a tool that can visit complex routes
Many Windows programs have a maximum path length of less than 255 characters and therefore allocate sufficient internal storage space for these typical paths only. The NTFS file system does not provide this limit and allows the use of longer paths.
This problem may occur if you create a share at a certain point in the folder structure at a sufficiently low level, and then create a complex structure below that point by using sharing. Some tools that act locally on the folder structure may not be able to visit the entire structure starting from the root folder. In order for these tools to visit sharing, it may be necessary to use them in a particular way. A method for visiting the entire structure in this situation is described in the documentation for the CreateFile API.
Generally, it is possible to manage the files using the program with which they were created. If you have a program that can create files that exceed the MAX_PATH limit, you can generally use that same program to delete or manage files. Files created on a share can usually be deleted using the same share.
If you cant able to follow the above-mentioned solution you can try SuperDelete to delete those files. SuperDelete is a free command line utility for Windows that lets you remove files and folders with very long path names. And this utility comes very handy when Windows Explorer is not able to delete a few unwanted files that have the path longer than 260 characters.
This tiny tool is super easy to use and configure. All you need to do is download the script and open a CMD window and execute commands to delete the files. SuperDelete supports files having path up to 32767 characters which are way beyond the default 260 character limit. So, the tool should work pretty much fine for normal users.
Note: if you have full admin access then there is no need check the ACL, You are good to delete the files and folders Directly.
How to Use SuperDelete to fix Source path too Long Error?
Click here to download the SuperDelete from Github directly.
Download the latest version, Optionally you can download the source code as well if you want to include SuperDelete in your projects or want to compile it yourself. Once you have the executable, open a CMD window in that folder.
Now Type the above-mentioned command in the command prompt, Type the path of the file or folder which you want to delete, this command will delete the file and give the confirmation message. Once you got the confirmation then check the path whether the file is deleted or not.
superdelete.exe -s path
This command works in a similar way; the only difference is that it would not show any confirmation. It will directly go ahead and delete the file without a prompt.
superdelete.exe –bypassacl path
This command implements the feature that we’ve been talking about in this post. If you have administrator rights on the drive, you can bypass all the ACL checks even if you do not have sufficient rights in ACL to remove that file. This is useful when a drive is moved from another machine or Windows installation.
SuperDelete is an amazing little tool that gets the job done. The tool runs entirely from the command line, and some users might find it difficult to access. But all in all, this tool works when it comes to deleting files with long paths which cannot be accessed by Windows Explorer.
Or You are finding difficulties to delete those files use the software Long Path Eraser to delete the file that has a long path.
Click here to download–>Long Path Eraser.
Long path Tool is my favorite tool.This works fine compare to any other tool.
Click here to download–>Long Path Tool.