How to delete directories with path/names too long for normal delete
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2
--
Chapters
00:00 Question
01:30 Accepted answer (Score 89)
01:53 Answer 2 (Score 491)
02:18 Answer 3 (Score 319)
03:12 Answer 4 (Score 205)
05:44 Thank you
--
Full question
https://superuser.com/questions/78434/ho...
Question links:
[this question]: https://superuser.com/questions/45697/ho...
Answer 1 links:
[7-Zip]: http://www.7-zip.org/
Answer 2 links:
[rimraf]: https://github.com/isaacs/rimraf
[Node.js]: http://nodejs.org/
[npm]: https://www.npmjs.org/
Answer 3 links:
["Path too long? Use Robocopy" by BVLANGEN]: http://web.archive.org/web/2017030220590.../
[How to delete a file in Windows with a too long filename? [duplicate]]: https://superuser.com/a/467814/43193
[Benoit]: https://superuser.com/users/50883/benoit
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #filemanagement
#avk47
ANSWER 1
Score 499
Use the 7-Zip File Manager to delete them.
If you are still having trouble, ensure that you utilize Shift+Delete inside the 7-Zip File Manager. Otherwise, Windows tries to move them to the Recycle Bin (which will fail again).
ANSWER 2
Score 319
None of the other (free) answers here worked for me, but I found one on another site:
rimraf <dir>
rimraf is a Node.js package, so you will need to install Node.js which includes npm. Then you can run:
npm install -g rimraf
Then you can run rimraf
from the command line.
I found this solution because npm itself was causing this problem due to the way it nests dependencies.
By the way, rimraf
gets its name from the UNIX command rm -rf
, which recursively deletes files and folders.
ACCEPTED ANSWER
Score 89
I believe I've found a way to delete things from cmd
. Originally I tried the del
command, but that didn't work. Then I remembered rmdir
. Doing the following:
rmdir /S /Q <dir>
seems to have worked.
ANSWER 4
Score 34
Without installing additional software you can use subst
command to temporary create an alias to a long named directory.
e.g. If you want to delete folder C:\Very long directory\that exceed\length limit\blah blah blah\abcde\folder to be deleted
you can use the command
subst x: "C:\Very long directory\that exceed\length limit\blah blah blah\abcde"
and then you can delete X:\folder to be deleted
in Windows Explorer or in command prompt easily. To remove the temporary drive letter alias use the command
subst x: /d