Solving the "source path too long" NTFS issue
TL;DR
If you're trying to delete a folder or file and Windows keeps barking at you "Source path too long", use rimraf command line utility instead.
The problem
Sometimes you end up having large folder trees on your hard drive that NTFS simply can't delete. Web / Node.js developers happening to work on Windows are probably aware of this issue (why would a Web / Node.js developer be working on Windows is a good question and the subject of another story).
This may look like a minor issue, but really can be a show-stopper if you're trying to use Node.js apps on Windows.
Leaving aside the technical mystery of how is the OS able to create those files but cannot delete them, here's how sane people would try to solve this problem:
File Explorer - Delete
Nope. Can't do it.
File Explorer - Shift+Delete
I know. If it's too long for Recycle Bin, I'll just use Shift+Delete.
No, it doesn't work. Hmmm...
Command prompt
I'm a technically-literate person, so I'll use rmdir
in Command Prompt.
WTF?!...
The insane way: access the drive from a different OS
People happening to dual-boot their computers will be able to remove the stubborn file / folder by mounting the drive in Linux. It's impractical, though, even for geeks.
What you should do
Node.js developers may be familiar with a cool little useful NPM called rimraf. Although rimraf is mostly used in Node.js application scripts, it does have a command-line utility. Which means you can install it globally like this (assuming you already have Node.js installed):
npm i -g rimraf
Then you can simply use rimraf
instead of rmdir
, like this:
Written by Ionut-Cristian Florescu
Related protips
23 Responses
Well, I see no point in using Long Path Tool or any other paid app when my workflow already includes Node.js and there's a free and faster command-line alternative in the ecosystem.
just try duplicate files deleter, it is a great solution of that issue....
Long Path Tool help me a lot when i have an issue like file deleting or renaming the file. Also good to use if file name and file extension is too long
“Long Path Tool” is very helpful for this error !
You can use to solve this problem
Long Path Tool help me a lot when i have an issue like file deleting or renaming the file. Also good to use if file name and file extension is too long.
This is the right solution to this issue by far! I never thought to find the answer in a web developer site. Thank you very much, you guys made my day.
“Long Path Tool” is very helpful for this error !
best solution for your problem.
So much shameless advertising about that "long path tool" or whatever it's called...
Thank you,
Long path tool is the very good program for error, unlock solution.
Try it and solve your problem.
I used long path tool and I solve my error, unlock problem solution.
Hello everyone,
I suggest everyone a software which can solve this problem. The name of the software is Long Path Tool
.
thanks
snizhana
Hey I suggest that you try Long Path Tool.
It´s a great tool to to fix the message that say "The specified file or folder name is too long. The URL path for all files and folders must be 260 character..."
I used it and had a good and fast solution to my problem.
Highly recommendable.
I would also recommend using Long Path Tool. It's the best help you can get
I would also recommend the long path tool . Some says it don't work but it really work perfectly fine for me. :)
I would like to suggest you, try LongPathTool program to resolve this issue. This tool is very helpful to resolve the issue.
You can use Longpath Tool. It worked for me like a charm.
Have you tried long path tool?
it's very useful in this type of case.
use long path tool....it's very helpful for me.
I suggest you try Long path tool is the very good program for error, unlock solution.
Try it and solve your problem.
I used long path tool and I solve my error, unlock problem solution.
I would like to suggest you, try LongPathTool program to resolve this issue.
This tool is very helpful to resolve the issue.
I suggest you Long Path Tool will let you easily delete, copy or rename long path files, you can try it for better service.
Long Path Tool help me a lot when i have an issue like file deleting or renaming the file. Also good to use if file name and file extension is too long
i try longpath tool software to solve long path file that can not open. so you can try this . Good Luck
Many tools can handle this issue like Gs Richcopy 360, Long Path Fixer ...etc, but I find your way can be applied, my question is how can your way work for example over 100 paths at once?