I have about 500 empty directories on my c: drive with names like the ones pasted below. I believe a failed Quicken install left them there. Anyway, normally this would be no big deal, but in this case, they are all at the root level and it makes my "real" directories hard to find. I've tired several things to get rid of them. Here's an example of one of my attempts from an Administrators command shell:
dir *.tmp
. . .
09/11/2015 04:51 PM <DIR> QuiFAC7.tmp
09/11/2015 04:51 PM <DIR> QuiFAC8.tmp
09/11/2015 04:51 PM <DIR> QuiFAD9.tmp
0 File(s) 0 bytes
501 Dir(s) 1,337,724,145,664 bytes free
C:>rmdir quifad9.tmp
Access is denied.
C:>takeown /f quifad9.tmp /a
SUCCESS: The file (or folder): "C:quifad9.tmp" now owned by the administrators group.
C:>rmdir quifad9.tmp
Access is denied.
I've tried it with PowerShell and with the "hidden" Administrator id, no luck. I also tried to change the security setting for the c: drive itself, also with no luck. Do any of you have a PowerShell script or something similar which will remove these annoying empty directories?
John
Hi TexasJohn and welcome to windowssh blog.
Perhaps you can try booting to this custom Win10PE disk one of our members has prepared.
Windows 10 Recovery Tools - Bootable Rescue Disk - Windows 10 blog
You can try deleting the directories that way.
The trick is to delete them without Windows running. Thus if you have Windows installation media, you can boot from that, select Repair, Troubleshooting, and navigate to a command prompt.
The owner of an object doesn't necessarily have authority to do anything with it (except change authority). You have to both take ownership and grant authority - it was the second step you were missing.
As they are directories you should specify /ron takeown and /ton icacls to recurse through any contained files/directories also.Code:takeown /f quifad9.tmp /r icacls quifad9.tmp /grant "%USERDOMAIN%\%USERNAME%":(F) /t
If they are locked though you'll need to delete them from outside windows (or at least when whatever is locking them isn't running) as mentioned in the posts above.
Thank you, the icacls command did the trick. All those directories have now been deleted.