I been having issues with removing user folders I go the users directory and I right click and want to remove one folder which I deleted the user account from control panel. I get this message which I attached. I been searching for a solution though none so far.
I wanted to just control the user folder. I do not understand this command.
cacls C:\Users\username /T /E /G user:F replace username with the directory name and user with your username.
lets see if I do understand I want to remove maint folder so I would type
cacls C:\Users\maint /T /E /G maint:F <--correct?
Its interesting been building my systems for years but I get struck on the command-line OMG.
I get a lot of results from typing the first command. I was going to attach the out file of the command but extensions not supported is all I got so copy and paste as code.
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\Application Data" now owne
d by user "PC1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\CEF" now owned by user "PC
1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\Google" now owned by user
"PC1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\History" now owned by user
"PC1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\IconCache.db" now owned by
user "PC1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\Macromedia" now owned by u
ser "PC1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\Microsoft" now owned by us
er "PC1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\Mozilla" now owned by user
"PC1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\Temp" now owned by user "P
C1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\Temporary Internet Files"
now owned by user "PC1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
ta\Application Data\Application Data\Application Data\VirtualStore" now owned by
user "PC1\Home".
SUCCESS: The file (or folder): "C:\Users\maint\AppData\Local\Application Data\Ap
plication Data\Application Data\Application Data\Application Data\Application Da
Neither of those commands would delete anything. By design Windows uses the DAC ACL model or discretionary access control. When a user profile is created that user is the owner of their user directory. My the DAC design the owner has the discretion to grant access to their directory. Even if you are an administrator you do not have permissions to do anything on another users directory; however, as a member of the administrators group you have the ability to take ownership (the first command TAKEOWN) of their user directory. By the DAC model you now have the ability to grant permissions since you are the owner. After granting access (the second command CACLS) you can then delete the directory if you want either by selecting the directory and press delete. Right clicking the directory and selecting delete or from the command prompt rmdir /S /Q C:\users\maint
A breakdown of the CACLS command
CACLS C:\users\maint /T /E /G user:F /T means apply the ACL recursively to everything in the path including sub-directories and files in this case C:\users\maint /E means edit the existing ACL instead of overriding the existing one (if you didn't do this any other access would be removed) /G means grant /R would be to remove access user:F is the user the ACL applies to and the :F is the access F denotes full access
I decided on not worrying about the users on this system I am building a new system soon. The reason I wanted to is cause one user account had a bad folder as I call it and it was in the music folder. Now on my new user account Home. I have a Dave folder with a subfolder has the same issue this I can see the folder but windows does not and I can not remove it. Plus there is no security info on this folder it states info cannot be displayed. I moved all the data to another folder called David folder and marked that folder as bad and do not use. Something is wrong with either windows or the HDD for this to happen again I never seen this before on windows 7. I did smart test with crystaldiskinfo on the HDD and its all normal. I am finalizing my build for my win10 system. Does anyone have a idea what could cause this type of error? I found out about the bad folder with my backup tool freefilesync which would not copy a file from that folder for the backup.
If you didn't run the takeown command first then that's why it's not working. If you did and still getting access denied then it's possible the files are locked by avast, potentially through a filter driver and you'd need to remove that driver first.
Thank I am going to close this thread since I have built my new system. I am going to be at some point recycling this system which this thead is about. I understand now that I need to remove avast than perform the commands. I am planning on not creating to many user accounts on the new win10 system.