Sometimes when deleting a folder first the UAC fires up and you’re asked to continue. Then the user is prompted “Cannot delete Folder: It is being used by another person. Close any programs that might be using the file and try again”. Of course other prompts you might see include:
- “Cannot delete file: Access is denied”
- “There has been a sharing violation”
- “The source or destination file may be in use”
- “The file is in use by another program or user”
- “Make sure the disk is not full or write-protected and that the file is not currently in use”
First let’s figure out the Problem:
Let’s say you have the main folder named ‘folder1‘, and in it there’s another folder aka ‘folder2‘. You try to delete folder1 but an Access Denied prompt is loaded. What should I do? There are three solutions..
- The Simple Solution
- The Slow Solution (but easy)
- The Fast Solution (but technical)… after the break…
Now the Solution 1: The Simple Solution…
Most of the time, this happens because there is another folder in the folder you’re trying to delete. So to delete folder1
- open folder1
- delete folder2
- delete folder1
This works fine. But if you many folders with multiple sub folders… then it’s a big problem… cause to open each folder and each and every folder in it… it’s one hell of a nightmare…
So here comes Solution 2: The Slow Solution…
As the title implies, this is another solution… but the more folders you have, the slower it gets. Next are the steps:
- Go to folder1, right click and choose properties
- Click the ‘Security’ tab
- Click ‘Edit’ to change permissions
- Another windows is loaded… click ‘Add’
- Enter your username and click ‘Check Names’
- Click ‘Ok’
- Set any extra permissions you need (by clicking the checkboxes)
- Click ‘Ok’
You now have permission on all the folders in the folder on which you clicked to view properties. But if you have many folders, it will take a long time… if so check solution 3.
Solution 3: The Fast Solution…
This solution is very fast but is a bit technical as well… cause you need to use the command prompt (cmd) to use this solution. You need to have administrative rights to do this in cmd… so in the search box when clicking start, enter command prompt… the search finds it… but instead of clicking on command prompt… right click and select ‘Run As Administrator’.
Now enter the following text in command prompt:
- takeown /f full_path_to_directory /r /d y
To set security access enter the next text as well, which will grant access to administrators role
- icacls full_path_to_directory /grant administrators:F /t
If you are not in the administrator role or you still can’t delete files, enter the next command:
- icacls full_path_to_directory /grant your_username:F /t
If you’re not comfortable with using command prompt, it’s better if you use solution 2… it might be slow but it’s surely easier and user friendly. If you have any other questions… just write them down!