Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a backup copy of a previous Windows' Documents and Settings folder which only contains my original user and within 2 more directories: Favorites and Local Settings.

When I try to delete Local Settings I get this error:

alt text

When I try to delete Favorites, I get this error:

alt text

I ran this in a cmd shell:

attrib *.* -r -a -s -h /s

...but it did not help, nor did it return any errors/warnings.

I used Unlocker v1.8.5 and LockHunter repeatedly at multiple levels to see if any files are in use, but both always say: No Files Locked.

Update #1:

I was able to rename the directory, which now gives me this warning before (trying to) delete:

alt text

If I press Yes (or Yes to All) then I get this error:

alt text

Update #2:

I let chkdsk /f run which required a reboot since it's on my primary system partition. During Stage 2 scanning, I received about 40 of these:

Deleting an index entry from index $0 of file 25.

...followed by:

Deleting index entry cookies in index $I30 of file 37576.

...but I still get the first error dialog above when trying to delete.

I ran chkdsk again, this time: chkdsk /f /r. Produced no messages. Same result when deleting.

Update #3:

Digging deeper, the 99 is the name of one of many directories located deep in here:

C:\Documents and Settings.OLD\User\Local Settings\Application Data\Microsoft\Messenger\address@hotmail.com\SharingMetadata\user@hotmail.com\DFSR\Staging\CS{D4E4AE55-B5E2-F03B-5189-6C4DA6E41788}\

Inside each of those directories were files with names such as:

2300-{C93D01AC-0739-4FD9-88C7-13D2F21A208E}-v2300-{C93D01AC-0739-4FD9-88C7-13D2F21A208E}-v2300-Downloaded.frx

I noticed that, unlike all the directories, I couldn't rename any of these files. I also noticed that the file + dir names were extremely long:

Original directory = 194 characters
Filenames = 100+ characters
Together the length exceeds the 255-char limit which is bad and would explain the error message I posted in Update #1.

Partial Solution:

Rename all directories until the total path length is less than 100. Afterwards I was able to rename the .frx files, not to mention delete everything inside the Local Settings directory.

This is only a partial solution because these (empty) directories are still not deleteable,

C:\1\2\Favorites\Wien\What To Do..
C:\1\2\Favorites\Photography\FIRE

Same error as above:

alt text

Here is what Explorer properties shows for both folders:

alt text

Update #4 (another partial solution):

Using harrymc's answer combined with thoroughly reading through this amazing MS-KB article which contains nearly everyone's idea and then some, inconspicuously titled: You cannot delete a file or a folder on an NTFS file system volume.

I was able to delete the 2nd folder C:\1\2\Favorites\Photography\FIRE - the problem being that there was an invisible trailing space at the end. I got lucky when I did an auto-complete whilst playing around with the del "\\?\<path>" command which he suggested.

NOTE: A normal del did NOT work, nor did deleting from explorer.

Now all that is left is the first directory C:\1\2\Favorites\Wien\What To Do.. (yes I tried endlessly with multiple combinations of the above solution ;)

share|improve this question
    
@glenneroo try using LockHunter instead of Unlocker and see what it says. Also, what happens when you click "Yes" or "Yes to All" in the "Confirm File Delete" box? –  ubiquibacon Jan 5 '11 at 21:17
    
LockHunter also says no processes are locking this file or folder. –  glenneroo Jan 6 '11 at 3:25
    
I had a similar problem as you with some Adobe files buried deep in some folders from a backed up windows install. I tried renaming all the folders to 'x' to shorten the path, but it didn't work. I left them that way to remind me they weren't anything and let them sit there for a couple years until I finally DBANed the disc before sending it off to someone. –  Tofystedeth Jan 6 '11 at 20:34
1  
Because of the extremely little file properties you see (not even dates), I am thinking this is file pointer that points to a file that does not exists. I don't know how to fix this though, but this might give an idea to someone that knows... –  awe Jan 18 '11 at 19:14
1  
Just because there are some dead files that aren't even using up much space? The drive is ~2 years old and I'd rather not have to re-install again. As for SMART readings, Google released a report here that basically said you can't put too much weight on most of those readings: labs.google.com/papers/disk_failures.pdf Also chkdsk /R reported nothing wrong. Can you recommend a tool for Windows as an answer? –  glenneroo Jan 19 '11 at 8:09

11 Answers 11

up vote 17 down vote accepted
+50

del is for deleting files, rd aka rmdir is for deleting folders, so...

rd /s "\\?\C:\1\2\Favorites\Wien\What To Do.."

...should do the job! :-)

The /s parameter

removes all directories and files in the specified directory in addition to the directory itself.
Used to remove a directory tree.


If this doesn't work; even not with wildcards/auto-completion; then you have corruption issues.

share|improve this answer
    
oh man that looks like it could be the answer right there :-) –  James T Jan 29 '11 at 8:37
    
Wow amazing someone finally got it! You win a double-bonus! :) –  glenneroo Jan 29 '11 at 22:49
    
@glenneroo: Have upvoted everyone that helped towards this as a return. :-) –  Tom Wijsman Jan 29 '11 at 22:53

I would try running chkdsk first as Jeff suggested. If this does not work, you could boot up with a linux live cd, mount the hard drive and delete the folders from within the linux live environment.

share|improve this answer
    
I'm extremely hesitant to use an alternative (to the closed-source NTFS) to delete files from a NTFS partition. From my experiences, read support usually works fine but writing can be dangerous. –  glenneroo Jan 5 '11 at 21:02
1  
write support on NTFS is now very good on modern linux distros, especially considering even WinXP does not completely implement the NTFS spec. –  Jonathan Jan 5 '11 at 21:14
1  
Agreed, Linux has excellent NTFS Support. –  Jeff F. Jan 5 '11 at 21:59
    
Not long ago (Summer of 2010) I used ntfs-3g to delete files before re-installing XP. Afterwards during XP installation, chkdsk found a metric shedload of corrupt files. I've also managed to kill ntfs drivers in the past just doing reads. Granted both cases were on extremely fragmented partitions with several 100,000 files. –  glenneroo Jan 5 '11 at 22:14

You very likely have FS(filesystem) corruption. Run a chkdsk then attempt to remove the files.

Also make sure nothing is in use within the directory as the warning suggests.

I would also recommend making a backup of your important files before anything.

share|improve this answer
    
I used the tool Unlocker to verify no handles were open on any of those files. –  glenneroo Jan 5 '11 at 21:02
    
That's what I figured. You probably need to run chkdsk /f –  Jeff F. Jan 5 '11 at 21:05
1  
@Moab: No, the index cleanup with chkdsk is normal. It's an artifact of how they're stored, they can only be cleaned up during a disk check. I can't remember where I read that though. –  afrazier Jan 5 '11 at 23:52
1  
@glennroo - bsod's during write operations are signs of failing disk, too. I wouldn't be surprised to see your disk last another year, but I also wouldn't be surprised to see it die tomorrow. –  Joel Coehoorn Jan 6 '11 at 1:48
1  
I see that you have trid chkdsk /F; try also chkdsk /R which performs 2 additional steps to attempt to mark bad sectors and recover data. –  AniDev Jan 18 '11 at 17:11

I still receive the Error 99 dialog above when trying to delete.

99 isn't an error number — it's the name of a file or folder inside the folder you want to remove. Look for this item.

Once you find it, it's just complaining about a permissions error. This is likely because certain things in users' profiles folders are set up to only have permissions for that user and no one else, and are set not to inherit permissions from their parent, or for some other reason all permissions on the file were lost. The result is that no user account on your computer has the ability to do anything with the file or folder.

To fix this, right click on the file (or it's containing folder to ensure you get everything), choose Properties from the context menu and then the Security tab in the dialog that opens. This screen will have an Advanced button that you should click. Look for the Owner tab on the dialog the opens. You should now be able to use this window to take ownership, which will assign new permissions entries to the item and finally allow you to delete it.

share|improve this answer
    
Good point about the filename! Setting permissions didn't help, but incidentally I found half the answer! –  glenneroo Jan 6 '11 at 2:54

You may be able to use the Unicode \\?\ syntax in cmd to delete too-long directories, as the path-length with this syntax is "limited" to 32,767 characters :

del /s /f /q "\\?\C:\Documents and Settings.OLD\User\Local Settings\Application Data\Microsoft\Messenger\address@hotmail.com\SharingMetadata\user@hotmail.com\DFSR\Staging\CS{D4E4AE55-B5E2-F03B-5189-6C4DA6E41788}\"
rmdir "\\?\C:\Documents and Settings.OLD\User\Local Settings\Application Data\Microsoft\Messenger\address@hotmail.com\SharingMetadata\user@hotmail.com\DFSR\Staging\CS{D4E4AE55-B5E2-F03B-5189-6C4DA6E41788}\"

It might help to press the tab key to cycle through directory names once you get a \, so that Windows will start auto-completing the directories that exist under that folder.

See Microsoft's Naming Files, Paths, and Namespaces.

share|improve this answer
    
This will work, but I believe the del command has the MAX_PATH limit :( –  Billy ONeal Jan 20 '11 at 3:00
    
Nice trick! I got around the long file names by renaming directories to 1-2 chars. I tried these commands on both remaining directories: Could not find file. followed by a The system cannot find the file specified. –  glenneroo Jan 20 '11 at 5:52
    
Updated my answer. Using this version of del i was able to delete one of the two remaining offenders (which had a trailing space). Bounty is yours, but the plot thickens! –  glenneroo Jan 20 '11 at 6:25
    
In ultra problematic cases, you might be able to delete instead the containing directory (after moving out the stuff you wish to keep). –  harrymc Jan 20 '11 at 6:46
    
Very pleased, I've had a corrupt directory name for 3 years and finally found this! Using the rmdir command above allowed me to get rid of the broken dir. –  hazymat Mar 2 at 15:21

The following I have read on Microsoft's support site:

1) use dir /x to get the short names (8.3 notation) of files / folders listed 2) use rmdir /s shortname to remove a folder whose long name is non-standard

share|improve this answer
    
Good idea! Unfortunately all the folders that I can't delete have no short name i.e. it's empty when I type dir /x :( –  glenneroo Jan 18 '11 at 13:21

I personally agree with byachna and CarlF that a linux live cd is your best bet. Linux doesn't care about permissions so you can go in and delete stuff without it complaining. I've never had any issues with NTFS writing from linux. I've been doing it on a regular basis for several years.

I understand you don't want to mess with linux, so I'll suggest something else. Something that Ashimema already suggested... but forgot a few links. Instead of a linux live cd, you can try one of the many windows live cd's.

http://www.ubcd4win.com/ (requires xp install cd to create)

http://www.reatogo.de/REATOGO.htm (requires xp install cd to create)

http://www.nu2.nu/pebuilder/ (requires xp install cd to create)

http://www.vistape.net/index.php (requires vista install dvd to create)

Try booting up in whichever live cd you decide to use and delete the folders that are causing all the problems. Since it is windows, it will enforce file permissions. You might have to change the permissions or ownership of the files in order to delete them. Perhapse even try the "\?\" trick from the live windows cd.

Another thing to try would be the cacls or icacls command to see if you can give yourself permissions on the folders.

share|improve this answer
    
Will give them a try and report back (when I have a couple hours). –  glenneroo Jan 29 '11 at 11:59

Boot your system using an NTFS-aware Linux distro, say an Ubuntu liveCD.

Mount the Windows file system.

Delete whatever you want, since Windows won't be able to say "No."

BEFORE DOING THIS MAKE A FULL BACKUP.

share|improve this answer
1  
Thanks but byachna already suggested this. I hesitate to try because I've had problems in the past with corrupted filesystems. Also this case is dealing with corrupt files i.e. using an unsupported NTFS driver might just muck up my system completely. –  glenneroo Jan 18 '11 at 17:16
    
The current NTFS drivers in Linux are actually less likely to corrupt filesystems than Windows, in my limited experience. –  CarlF Jan 19 '11 at 18:45
3  
I'd really really like to see data to back up that statement. I've never had Windows corrupt a FS except for failing hardware. –  Billy ONeal Jan 20 '11 at 2:59
    
There's a reason I wrote "in my limited experience". I've had a couple problems like glenneroo's using Windows (XP and Vista) and none with NTFS-3G. I thought the disclaimer would make that clear. –  CarlF Jan 20 '11 at 13:39

There are a number of convoluted and difficult ways to solve this as I've found out in the past.

Now that i'm confident with what i'm doing, I'de simply run a chkdsk, then boot up a live cd to delete the files if there was still a problem (if your worried about linux's abilities with ntfs, then try out either BartPE or [Windows PE][2], both freely available)

If your going for the long way round, all the other suggestions will certainly help you whittle down the actual error.

share|improve this answer
    
Cheers James for adding the links I could not (being too new here) in a post below! –  Ashimema Jan 29 '11 at 15:11

Late to the party but this method works most of the time, if not boot from a linux distro and delete from there.

Open an elevated Command Prompt window and leave it open.

Close all open programs.

Click Start, Run and enter TASKMGR.EXE Go to the Processes tab and End Process on "Explorer.exe" Leave Task Manager open.

Go back to the Command Prompt window and change to the directory the AVI (or other undeletable file) is located in. At the command prompt type DEL < full path to the file you wish to delete>, or whatever command you desire.

Go back to Task Manager, click File, New Task and enter EXPLORER.EXE to restart the GUI shell. Close Task Manager.

share|improve this answer

Joel's answer is half right, you need to activate the security tab first, go to control panel > folders options and the second tab(i forgot its name) in the end of the list with options there is something about advanced folder management(again i don't know whats the name in english) once you do that you can then set permisions for your user in the security tab as mentioned before.

share|improve this answer
    
I already had those options enabled, plus I already tried what he recommended but it didn't help. Read Update #3 and Partial Solution for what is happening. The folder that I can't delete doesn't even have any properties, much less security options. –  glenneroo Jan 6 '11 at 3:22
    
Make sure you add full access and options to the user EVERYONE, with the user verifier included you can do this. –  Guillermo Siliceo Trueba Jan 6 '11 at 3:28

protected by slhck Feb 28 '12 at 21:47

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.