dslreports logo
 
    All Forums Hot Topics Gallery
spc
Search similar:


uniqs
613

jaa
Premium Member
join:2000-06-13

jaa

Premium Member

[WIN7] Retaining file permissions

If I move a file from one folder to another, it seems to retain the original file permissions.

If I copy a file from one folder to another, it seems to get the file permissions from the folder it was copied to.

The problem is moving files to a public folder - it seems other users do not have access to the file if it came from a private folder they did not have access to.

Is there a way around this to a move is more like a "copy" and then a "delete"?
dave
Premium Member
join:2000-05-04
not in ohio

dave

Premium Member

The difference in behaviour is explained by it being 'a new file' versus 'the same file'.

Being a lazy man, I'd go for 'copy and delete'.

Unless you do this often and/or with very large files. In which case, perhaps icacls filename /reset does what you need.

jaa
Premium Member
join:2000-06-13

jaa

Premium Member

If it were me, that is what I would do.

Is there a simple command that will apply the folder permissions to all subfolders and files? I could just run that hourly to fix the permissions.

Would this work if I created a cmd file and "run as administrator"?

cd \myfolder
icacls *.* /reset /T

Reset to inherited permission for all files, folders, and subfolders?

If I do that by going to the security of "my folder" and go to advanced, and then tell it to replace the permissions on subfolders, I get a denied error because I am not the owner (I am an administrator).
dave
Premium Member
join:2000-05-04
not in ohio

dave

Premium Member

"Would this work"?

Probably - but you can test it out by running a command prompt as administrator and then typical that exact same command sequence.

(Btw, '*.*' is oldthinkful - we can just say '*' these days, since dot is more-or-less just a character like any other).
dave

dave to jaa

Premium Member

to jaa
By the way, icacls is not going to change the ownership of files moved in, only the protection. Is this important to you? Do you need standard ownership?

icacls /setowner or
takeown

should do the trick (the two have slightly different semantics).