Error when try to delete "access is denied to this folder"

Published on
10,834 Points
3 Endorsements
Last Modified:
Community Pick
From time to time while working with windows o.s. we see the error "access is denied to this folder" when we are trying to delete a folder. The reasons can be many and so can be the solutions too.  Here are some small tips/tricks that have worked for me and thought you too might find them useful.

1. Change Permission

If you need to delete a file (e.g., c:\got_to_go.exe) from your computer, but cannot because of permission errors, then you can get around this by changing the files permissions from the command prompt by doing the following:
Cacls c:\got_to_go.exe /p username:w
This will change the permissions on the file from the System Account to the user that is currently logged in.  Once this is done, you should be able to delete the file unhindered.

2. Remove Directory

if No.1 tip doesn't work, no problems, we can try to simply remove the folder.  In cmd window, to remove a folder like c:\virus type:

rd /S   \?\c:\virus\  

and now the folder should be gone you will not even going to see this in recycle bin. The syntax “\?\” is used by volume shadow copy service and if  you remove it you cant restore it via recycle bin.

3. Kill Process Locking the file

You can try killing those processes that are accociated with this folder or just kill urs shell process explorer.exe in task manager (in the process tab) and then try to delete it

4. Try a Reboot

Sometimes a rouge process might own the folder / file and it is not obvious useing Task Manager. Sometimes a reboot will clear it up, but not all that practical on a server, but might work for your local machine.

5. Check for Malware

If you havent run a virus check for a while, now might be a good time to double check.

6. Use a Utility

You can also use various utilities - things like Norton became famous for providing various disk utilities. Nowadays, there are lots to choose from. I can recommend the free utility called unlocker assistant to delete these folders. You can download from here http://ccollomb.free.fr/unlocker/#download

I hope this little tip help you to remove that irritating error :-D

LVL 18

Expert Comment

by:Ravi Agrawal
Tip no 2

Remove Directory using \?\ is brilliant.

Voted Yes,


Expert Comment

these days win32.exe is very common in symantec enviroment to remove this virus .

Updates window full patch and antivirus tool .and log a call to symamntec they are true master on this

Expert Comment

if you patch your cluster and some how any of the node is not mounting the database   Please make sure both nodes should be properly path with same KB.

Administrative Comment

dsnegi_25dec -
I removed your comment about HijackThis, as it is not an "AV" application.
It is a very useful tool for some of the dianostics that need to be run in trouble-shooting problem computers, but is has not been maintained very well over the past couple of years - therefore not as reliable as it once was.

You should also keep in mind that you are commenting in an "Article", not a technical question.

Page Editor,

Expert Comment

TIP # 2 ...Thank You!  DEL *.* deltree none worked..couldn't rename from DOS nor explorer and couldn't delete or move contents..this command solved it!

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Join & Write a Comment

Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A query can call a function, and a function can call Excel, even though we are in Access. This is Part 2, and steps you through the VBA that "wraps" Excel functionality so we can use its worksheet functions in Access. The declaration statement de…
Other articles by this author

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month