winXP directory kerfuffle
January 6, 2006 6:44 AM Subscribe
How to delete a 150+ deep directory structure on WinXP?
I kinda hosed up my work PC yesterday. I was trying to use OpenGrok to index all of my source code, and blah blah blah I ended up with a directory structure like 150 folders deep. Now I am unable to delete any of them due to a "(206) Filename or extension too long" error.
So far I've tried:
-Deleting from the command line (both DOS & Cygwin)
-Cutting & pasting parts of the structure
-Renaming every directory to one letter to shorten them up
It doesn't really cause any major problems; I just want it gone. Isn't there some tool I can use to just nuke the whole directory and all of its subordinates?
I kinda hosed up my work PC yesterday. I was trying to use OpenGrok to index all of my source code, and blah blah blah I ended up with a directory structure like 150 folders deep. Now I am unable to delete any of them due to a "(206) Filename or extension too long" error.
So far I've tried:
-Deleting from the command line (both DOS & Cygwin)
-Cutting & pasting parts of the structure
-Renaming every directory to one letter to shorten them up
It doesn't really cause any major problems; I just want it gone. Isn't there some tool I can use to just nuke the whole directory and all of its subordinates?
Response by poster: Unfortunately, Explorer chokes on it from any point within the structure. Can't delete the root or anything underneath. I get a simple "Cannot delete file" box.
posted by yalestar at 7:19 AM on January 6, 2006
posted by yalestar at 7:19 AM on January 6, 2006
if you can get a directory listing with dir/s/b/a:d you could possibly then use a text editor to convert the txt into a batch file that specifically deletes each individual directory.
posted by duckstab at 7:24 AM on January 6, 2006
posted by duckstab at 7:24 AM on January 6, 2006
Deltree was removed from XP... try rmdir /s from the command line.
posted by GuyZero at 7:40 AM on January 6, 2006
posted by GuyZero at 7:40 AM on January 6, 2006
Have you tried scandisk? There may be a problem with the structure of your directory tree.
posted by boo_radley at 8:27 AM on January 6, 2006
posted by boo_radley at 8:27 AM on January 6, 2006
put a linux livecd (eg Knoppix) in your machine, mount the offending volume and delete from therein. Definitely do a scandisk before and probably after the deletion.
posted by polyglot at 8:37 AM on January 6, 2006
posted by polyglot at 8:37 AM on January 6, 2006
MoveOnBoot will delete a file before XP locks it down.
posted by Navek Rednam at 8:50 AM on January 6, 2006
posted by Navek Rednam at 8:50 AM on January 6, 2006
The problem isn't that the file is locked, it's that he must find a program that uses the unicode API, otherwise the name will be too long. Most older programs use the ANSI API.
posted by Rhomboid at 8:58 AM on January 6, 2006
posted by Rhomboid at 8:58 AM on January 6, 2006
You have tried dragging it to the recycle bin?
Have you tried writing a program to do it? If not using real API calls, maybe someone's runtime is up to snuff.
Besides the usual suspects of shell scripting, you might try VBScript. Drop these two lines into a .VBS file:
Then double-click.
posted by fleacircus at 10:14 AM on January 6, 2006
Have you tried writing a program to do it? If not using real API calls, maybe someone's runtime is up to snuff.
Besides the usual suspects of shell scripting, you might try VBScript. Drop these two lines into a .VBS file:
Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFolder("C:\fuckedfolder")
Then double-click.
posted by fleacircus at 10:14 AM on January 6, 2006
If the directory structure includes long file names try navigating a few levels deep at a command prompt using the short names and then deleting the directories below you. This may work where renaming did not because of how Windows renames directories (IE: it often doesn't really, just adds a new label).
Also if your on a network try creating a share on a folder half way down and then deleting the directories from another computer.
posted by Mitheral at 10:15 AM on January 6, 2006
Also if your on a network try creating a share on a folder half way down and then deleting the directories from another computer.
posted by Mitheral at 10:15 AM on January 6, 2006
One time when I was working in tech support I decided it would be fun to make a folder, copy the folder, copy both of those folders, copy all four of those folders, then put them all in the original folder, then copy the folder with the folders in it three times then deposit them all back into the first one and repeat the entire time I was on a call. I ended up with 75 megs of empty folders.
Same problem with deleteing them, I had to have my friend at work mount the drive from his linux box and delete it.
The answers allready been said, but I just wanted to relate how retarded I am sometimes
posted by JonnyRotten at 11:40 AM on January 6, 2006
Same problem with deleteing them, I had to have my friend at work mount the drive from his linux box and delete it.
The answers allready been said, but I just wanted to relate how retarded I am sometimes
posted by JonnyRotten at 11:40 AM on January 6, 2006
Best answer: This happened to me once. Its not possible to delete, but you should be able to move the lower levels of the tree to your root directory.
e.g. In explorer, go to the folder 140 levels deep, and move the contents to your C: drive. You can then delete the 10 folders from the C: drive. Keep repeating. Then go 130 levels deep, etc.....
posted by mach at 12:54 PM on January 6, 2006
e.g. In explorer, go to the folder 140 levels deep, and move the contents to your C: drive. You can then delete the 10 folders from the C: drive. Keep repeating. Then go 130 levels deep, etc.....
posted by mach at 12:54 PM on January 6, 2006
Cause 4: Files exist in paths that are deeper than MAX_PATH characters
http://support.microsoft.com/?kbid=320081
posted by Lanark at 3:57 PM on January 6, 2006
http://support.microsoft.com/?kbid=320081
posted by Lanark at 3:57 PM on January 6, 2006
« Older Maybe teach them to bark and glue fur on the sides... | Is there a service to email songs? Newer »
This thread is closed to new comments.
The problem is that if you use the ANSI version of the win32 API (DeleteFileA()) the maximum path length is 260. You have to use the unicode version of the API (DeleteFileW()) in order to access paths up to 32k characters. This is why you can't delete it in Cygwin, which uses the ANSI APIs. CMD.EXE is probably the same deal.
But explorer should be able to handle this without breaking a sweat.
posted by Rhomboid at 6:54 AM on January 6, 2006