GarrettBartley.com

Windows XP: Access is denied.

error_deleting_file_or_folder

Error Deleting File or Folder
Cannot delete filename: Access is denied.

Make sure the disk is not full or write-protected and that the file is not currently in use.

Sound familiar?

Over the years, I have stumbled into this error more times than I care to count. And I’m pretty sure the culprit is doing rsync backups from my Linux server to my Windows file server using CygWin. I finally think I have a fix, though. This is working in Windows XP and I assume that it will work in Windows Server 2000 and 2003 and maybe even Vista, Windows 7, and Server 2008 (as long as it’s Windows NT-based and NTFS).

If it’s a single file:

  1. Right-click on the offending file and go to properties.
  2. Go to the Security tab.
  3. Click on the Advanced button in the bottom right (above OK, Cancel).
  4. Go to the Owner tab.
  5. In the “Change owner to” frame, highlight your username, and then click Apply in the bottom right.
  6. Click OK a couple of times to get back to your file.
  7. Right-click on the file and go to properties (yes, again)
  8. Go back to the Security tab.
  9. Click on the Advanced button again.
  10. Make sure you are in the Permissions tab.
  11. Click the “Allow inheritable permissions from the parent to propogate …” checkbox.
  12. Click OK a couple of times to get back to your file. You should be able to delete it!

For a directory:

  1. Right-click on the directory and go to Properties.
  2. Go to the Security tab.
  3. Click on the Advanced button.
  4. Go to the Owner tab.
  5. Highlight your username.
  6. Click the “Replace owner on subcontainers and objects” checkbox.
  7. Click OK a couple of times to get back to the directory.
  8. Right-click on the directory and go to Properties (again).
  9. Go to the Security tab.
  10. Click on the Advanced button.
  11. Make sure you are in the Permissions tab.
  12. Click the “Allow inheritable permissions from the parent to propogate …” checkbox.
  13. Click the “Replace permission entries on all child objects …” checkbox.
  14. Click OK a couple of times. You may have to tell a pop-up message Yes.
  15. Delete the directory!

That’s been bothering me for years and nobody else seems to have had that problem (that or my Google-fu sucks). So, I’m putting this out there so that Google will pick it up and hopefully help out somebody else.

2 Responses to Windows XP: Access is denied. »»


Comments

  1. Comment by Eric | 2009/04/30 at 21:10:14

    It’s funny you posted this just days after I came across this:

    http://ccollomb.free.fr/unlocker/

    Especially useful because it tells you what is locking your files/directories. I haven’t had the need to try it out in the past week but the next time I get locked out, I’ll be ready.

  2. Comment by Garrett | 2009/05/01 at 14:03:38

    I searched LifeHacker.com for stuff like that, but the two that I tried failed miserably. :-/


Leave a Reply »»

Spam protection by WP Captcha-Free