Community Pick: Many members of our community have endorsed this article.

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

Published:
Updated:
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

Cheers
3
4,358 Views

Comments (5)

CERTIFIED EXPERT

Commented:
Tip no 2

Remove Directory using \?\ is brilliant.

Voted Yes,

Ravi.
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
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.
CERTIFIED EXPERT
Author of the Year 2011
Top Expert 2006

Administrative

Commented:
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.

younghv
Page Editor,
Experts-Exchange
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!

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.

Get access with a 7-day free trial.
You Belong in the World's Smartest IT Community