I have come across a situation where I am unable to delete a folder? Interesting right. I tired different ways to delete like how we does in Windows like every time we do. But no luck. After I did some research I found a way to delete file or folder which is too long to delete.
Here is the error message you will get when you try to delete these files or folders “Destination Path Too Long: The file name(s) would be too long for the destination folder. You can shorten the file name and try again, or try a location that has a shorter path. “
Usually windows cannot delete file path greater than 255 characters.
So here is the simple way to delete these folders by doing Map Drive to that location. Here is how we can do using command prompt.
- Start a command prompt (no admin privileges needed)
- Use cd to navigate to the folder you want to go (you can use tab to autocomplete names)
- Type subst Z: to create the drive letter association. (instead of the . you can also type the entire path)
C:\>subst Z: d:\Java.Works\adt-bundle-windows-x86_64-20140702 - Now in explorer you have a new letter in your computer. Go to it and do whatever you need to do to like by navigate to the files that have long names. You should now be able to rename/delete/etc them. The reason this works is because the path itself is no longer containing >255 chars
- Go back to your cmd window and type subst /d Z: to remove the drive like this C:\>subst /d Z:
This worked for me. Hope it works for you as well. Good luck
Heyy try LongPathTool..it will also become very useful in this kind of errors..
ReplyDelete