Move files, inherit permissions

Nov 13, 2008
255
3
www.thedave.me
Is there any way to move files, but inherit NTFS permissions in the destination? Or to trivially reset permissions of only the files that were moved (but not necessarily reset permissions of all files in the destination directory)

The best I've come up with so far is to call robocopy /mov, but this requires a bit of additional logic to build a list of the files that need to be moved due to the different syntaxes between TCC and robocopy. Doable, but I'm lazy if there's a shortcut.
 
May 26, 2008
537
4
With an internal TCMD command? Don't think so. But you can do it with SetACL. Hands down the best ACL manipulation command line tool.
 
May 26, 2008
537
4
BTW the command would be something like this:

Code:
SetACL -on <target> -ot file -actn rstchldrn -rst dacl
 

rconn

Administrator
Staff member
May 14, 2008
12,367
150
If the files are moved to a different location on the same drive, they will keep their permissions. (Except if you move it to the parent directory.) If they're moved to another drive, TCC doesn't do anything to transfer permissions (you're doing a COPY and then a DEL), so they inherit the permissions of their new folder.
 
Nov 13, 2008
255
3
www.thedave.me
With an internal TCMD command? Don't think so. But you can do it with SetACL. Hands down the best ACL manipulation command line tool.
Unfortunately that requires me to keep track of what files were moved to avoid mangling permissions on files already in the destination directory, so this gets complicated quickly.

If the files are moved to a different location on the same drive, they will keep their permissions. (Except if you move it to the parent directory.) If they're moved to another drive, TCC doesn't do anything to transfer permissions (you're doing a COPY and then a DEL), so they inherit the permissions of their new folder.

I realize that, but I was hoping there might be some sort of "and reset permissions" switch I missed, or similar technique to get reliable results without having to worry about whether the source and destination are on the same logical volume or not.

Switching to robocopy-compatible wildcards isn't too challenging for my current needs and will give me a lot better performance when I am crossing network paths so it's probably the best long-term approach.

Thanks all.
 
Nov 13, 2008
255
3
www.thedave.me
Just do a COPY followed by DEL.
That's a bit more complicated since a DEL might wipe files that failed to COPY successfully. I can workaround that by going file by file in a loop, but that's incredibly inefficient in terms of processing time (and is significantly less efficient than doing a move and then resetting the permissions)

I'd love to get away from the need to loop through individual files since there can be thousands of them at once in some cases, and I'd also like to avoid having multi-GB files get duplicated and then deleted if I can, although at the end of the day it looks like there's no fix-all solution.
 
May 26, 2008
537
4
I hate to say it, but when I need to do this I usually just use Windows Explorer (on the server itself). Starting with 2008 (or 2008 R2, not sure), moving files in Windows Explorer causes the files to get the permissions of the destination. It used to be moving files within a single volume would always result in the files retaining their original permissions, but that changed (at least when Explorer is used).

And another vote for SetACL... that is by far the best command line ACL manipulation tool...
 
Jul 16, 2013
2
0
Thanks for the answer. Maybe SetACL will work for me. I need to move a folder containing many files and subfolders with files to a new target folder in the same volume. The new target folder has different permissions than the source. I want the moved files and folders to inherit the permissions of the target folder.

So, using your earlier SetACL example,
SetACL -on <target> -ot file -actn rstchldrn -rst dacl
I would first move the source folder tree to the new target folder in the same volume, then run the SetACL command with the target being the new folder. Would this cause all files in the target folder to inherit the permissions of the target folder? What about subfolders and files in those subfolders?
 
May 26, 2008
537
4
Would this cause all files in the target folder to inherit the permissions of the target folder? What about subfolders and files in those subfolders?
Yes. The target folder and all files and folders it contains (including subfolders) will be reset with inheritance enabled. The DACL will match what is specified by the DACL of the target's parent folder.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Is there a way to retain file permissions when the files are moved, other than creating a list of current permissions, and reapplying them? BTW, is there a purpose for file permissions (of the ACL type, not the simple attribute types) on a personal computer, which - by its very name - is used by a single person, not a business?
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Very small businesses excluded, no, they are not personnel, they are resources, human (using military style cataloging). Do you know of any business today which employs personnel or has a personnel department? Everything is depersonalized. The computers belong to the organization, and their use is likely to be restricted by organization policies. Most importantly, the software and data on the computer do not belong to the person who uses it at the moment, but to the organization.
 
Dec 21, 2015
1
0
Is there any way to move files, but inherit NTFS permissions in the destination? Or to trivially reset permissions of only the files that were moved (but not necessarily reset permissions of all files in the destination directory)

The best I've come up with so far is to call robocopy /mov, but this requires a bit of additional logic to build a list of the files that need to be moved due to the different syntaxes between TCC and robocopy. Doable, but I'm lazy if there's a shortcut.

More about....Robocopy Commands

Biden
 
Similar threads
Thread starter Title Forum Replies Date
S How to? Move files older than one year Support 9
G Fixed MOVE truncates files Support 9
D Move /v to DVD fails but files identical Support 4
S Conditionally MOVE/COPY files on the basis of size Support 1
C question re: Move Support 3
samintz MOVE and Prompt on overwrite Support 3
M MOVE does not behaves like intended (on failure) Support 1
kb6ojs Make /G parameter persistent in COPY/MOVE command? Support 4
F Regexes in REN/MOVE/… commands seem to not work at all Support 3
T How to? Off screen move? Support 3
fpefpe Documentation copy/move using /c or /u Support 2
W Recursive move aborts early Support 2
C b21 MOVE /B Support 8
D How move cursor out of popup edit control after no match? Support 14
nickles Move takecommand.18.0.key location to installation directory Support 4
J junction copy/move handling Support 6
J WAD move /s regression from tcc15 Support 5
C move /F Support 4
vefatica MOVE anomaly Support 8
C Move /s sorce target Support 13
Stefano Piccardi b32 move /Q writes message Support 1
C How to? MOVE and handling out of space Support 2
Joe Caverly How to? Move Window Between Monitors Support 6
fpefpe move /g Support 4
C Move /MD not always working Support 1
C Move question with Encrypted file... Support 6
W /g option (%) on MOVE cmd appears broken TCC 14.03.57 x64 Support 8
C MOVE making empty destinatation sub-folders Support 10
A Discrepancy in handling of "can't copy or move file to itself" Support 4
A expected behavior of move /sx Support 14
S MOVE from FTP directory to another FTP directory - bug?? Support 2
J directory tree - move or copy Support 3
D MOVE Help typo Support 3
D Suggest Help mention /n no effect in move /n Dir1 Dir2 Support 0
S MOVE to different drive Support 3
Joe Caverly Move Buttons Between Tabbed Toolbars Support 2
S Another 4NT 8.02 vs TCC 9.02 diff - MOVE command Support 3
S MOVE command over FTP with 4NT 5.00U Support 0
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
fpefpe How to? shortcuts and batch files Support 4
C v28 key files Support 2
J ffind does not find files Support 4
C duplicate files in multiple plugin sites Support 9
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
S How to? Deinstalling TC/reinstating execution of bat files by cmd in Win7 Support 31
vefatica FFIND, temp files? ... not deleted? Support 0
R FUNCTION to count NUMBER of files matching a pattern and specific length/not length Support 4
vefatica Tmp files from in-process pipes not deleted Support 6
vefatica Finding files with alternate data streams? Support 4
rps Multi-column DIR /v not displaying all files. Support 5

Similar threads