18

I have a folder a 2003 member server which can't be deleted. Nothing has any permissions (domain admin and running up a cmd prompt as "nt authority\system" using psexec) - always "access denied".

When I do a dir /q, the owner shows as "...".

I've tried takeown.exe on the folder and also it's parent. The bad folder always reports "access denied". Also tried to reset using icacls, same thing.

Explorer permissions has no sharing & security options or tabs. It works fine for other folders, even in the same directory.

10 Answers 10

28

I've seen something similar to this. What ended up being the case is that the file was deleted while there were still outstanding locks on it. I couldn't do a darned thing to it. Clearing the outstanding locks caused the file to fully delete.

3
  • 5
    +1 - Absolutely could be that, as well. The OP should run something like SysInternals "handle.exe" and grep the output for references to the "undeletable" directory. – Evan Anderson Jun 9 '10 at 21:18
  • Just been back to check and run handle and it's now gone! Can only presume something was holding it, which has eventually closed and allowed the folder to delete. – winnt93 Jun 9 '10 at 21:40
  • 2
    If rebooting is an option, that can also work -- it did for me. After rebooting, all the folders/files that were there prior to reboot were fully deleted. – Olson.dev Oct 11 '17 at 15:11
4

I'd run CHKDSK on the volume before I did anything else. Are you seeing any messages in the System Event Log re: filesystem corruption (source "NTFS")?

3

Had the same issue but no files had a lock on it, it just managed to lose all of it's owners.

Solution was to use TakeOwn

takeown /F dirname

Will take ownership of the file to the current user. Use /A after the dirname to assign it to the system administrator.

2

I ran into a similar problem recently. The cause it my case was that another computer had the file open via a Network file Share. (it was a .dll and the other user had launched a program that opened it).

To close network shared files:

Control Panel -> Administrative Tools -> Computer Management

Then open System Tools -> Shared Folders -> Open Files.

It lists all the files open by another machine.

1

I've stumbled over this as well. The file had no owner and I could not delete it.

I've checked if there were processes holding a lock. None!

I've tried to set owner via "takeown". No luck, file does not exist!!!

The problem arose because of the naming of the file.

The filename ended in a dot, e.g. "OneDrive - Bla Bla.".

It seems OneDrive is creating filenames with dangling dots, whereas most other windows programs trim dangling dots off. So obviously does takeown and it ended up not finding "OneDrive - Bla Bla".

I've finally succeeded by using the 8.3 ms-dos name of the file, e.g "takeown /F ONEDRI~0"

To get the 8.3 name using "dir /x" is one option.

1

This has happened to me when Linux managed to corrupt my NTFS partitions partially. The following procedure should be able to restore your files:

  1. Open elevated command prompt.
  2. Navigate to a directory that contains problematic files or folders.
  3. icacls . /T /verify /Q
  4. Copy any lines containing "Acl length is incorrect." to a text file (for example, acl.txt). If there aren't any, we are done.
  5. for /F "tokens=*1 delims=:" %A in (acl.txt) do icacls %A /T /reset
  6. Repeat from step 3.
0

For deleting such files I first try unlocker. If that fails, or if there is some other operation I wish to perform on the file, I use my Bart PE disc.

0

You can use rd - rmdir which is removedirectory or delete folders,

You can use the following:

rd /s "\\?\C:\foldername\nextfolder\foldertodelete"

The /s parameter is to removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree. So, it will most likely delete it.

I have tried it before more than once.

PCGenie

0

I solved this problem with switching to the POSIX format:

del \\?\d:\path\problem_path\*
rmdir \\?\d:\path\problem_path\*

The problem now is, i cannot recreate the directory from explorer, or direct from cmd

0

Necroed, but I just had something very similar to this...

Running AccessEnum over Server2008 folders to audit file/folder permissions.

AccessEnum shows ??? as the owner.

Right click on file and none of the normal options available. Just Open and Send To.

.

Turned out it was due to the long path and long filename. 272 Chars total!

Dug down into the folder structure and Shared a folder towards the end of the path, now files can be ref with a shorter path.

Nothing wrong the files permissions etc, its was just Explorer choking on the long path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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