Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a batch command to take ownership of a set of user folders and I'm finding that the ownership is not being pushed down to hidden files, such as I'm using the following command: takeown /R /A /D Y /F D:\folderpath\username I don't see errors in the output, but when I try to robocopy that directory, I get access denied on such files. I find that I have to manually go to file properties > Security > Advanced > Edit (server 2008) > Replace all existing inheritable permissions on all descendants with inhabitable permissions from this object. Is there a way to make sure that I can move the folder after I've taken ownership of it?

share|improve this question
up vote 6 down vote accepted

Sounds like you took ownership with Takeown, but didn't give yourself read/write permissions (which is why you had to edit them via the GUI afterwards).

To do that from the command line you'd use icacls after using takeown.

Something to the effect of icacls <directory name> /grant <your username>:F /t.

share|improve this answer
After running the takeown command with the /A switch, administrators are automatically added to the ACL of the folder, just not the hidden files. Do I still need to run the icacls command? – Dave Oct 31 '12 at 13:01
/A makes the Administrators group the owner instead of you. Remember, just because you own it doesn't mean you have write permissions. :) – Ƭᴇcʜιᴇ007 Oct 31 '12 at 13:05
Worked great! Thanks for your help. – Dave Nov 1 '12 at 13:38
Sorry to bug again, however even after running icacls, I still received access is denied on hidden files that begin with ~. Any ideas? – Dave Nov 1 '12 at 16:13
Thank god for this answer!!! I've been pulling my hair out for hours trying to figure out how I can be the owner, yet have no access to delete a file! Sure enough, I didn't have read/write permissions and once I granted them, the file went the way of the dodo! Thanks again for this answer!! – MarqueIV May 13 '14 at 16:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .