Reset security attributes on move operation

Features wanted...
Post Reply
MrSpock
Posts: 29
Joined: 07 Mar 2008 00:24

Reset security attributes on move operation

Post by MrSpock »

When copying a file or moving it to another volume, permissions are inherited from the parent folder in the new location. But when moving a file in the same volume, original permissions are preserved. This behavior makes move operations unreliable, particularly in multi-user environments. This is true for both Explorer and XYplorer, but with Explorer it's possible to reset permissions even on move operations by reseting MoveSecurityAttributes in registry.

I would appreciate a corresponding option in XYplorer. It's possible to achieve this by passing the FOF_NOCOPYSECURITYATTRIBS flag to the SHFileOperation function.

Regards,

MrSpock

admin
Site Admin
Posts: 64886
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Reset security attributes on move operation

Post by admin »

MrSpock wrote:When copying a file or moving it to another volume, permissions are inherited from the parent folder in the new location. But when moving a file in the same volume, original permissions are preserved. This behavior makes move operations unreliable, particularly in multi-user environments. This is true for both Explorer and XYplorer, but with Explorer it's possible to reset permissions even on move operations by reseting MoveSecurityAttributes in registry.

I would appreciate a corresponding option in XYplorer. It's possible to achieve this by passing the FOF_NOCOPYSECURITYATTRIBS flag to the SHFileOperation function.

Regards,

MrSpock
Ah, did you know how much like wishes that come packed with the solution right away? :D So, to polish your wish, how would you call the checkbox in configuration? "Move Security Attributes" ? Or should I simply read out that registry value?

MrSpock
Posts: 29
Joined: 07 Mar 2008 00:24

Post by MrSpock »

I guess not all customers are software developers. :)

I'll be satisfied if you read that registry value, but a checkbox is probably a better choice for most users. Suggestion: "Preserve permissions on move operation" (on by default)

Thanks! I guess I have to upgrade to v7 now... :)

admin
Site Admin
Posts: 64886
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

MrSpock wrote:I guess not all customers are software developers. :)

I'll be satisfied if you read that registry value, but a checkbox is probably a better choice for most users. Suggestion: "Preserve permissions on move operation" (on by default)

Thanks! I guess I have to upgrade to v7 now... :)
Are you sure that only the Move operation is affected by this setting? The documentation seems to include the Copy operation as well...

MrSpock
Posts: 29
Joined: 07 Mar 2008 00:24

Post by MrSpock »

Well, security attributes are always reset when a file is created. If you copy a file or move it to a different volume, a new file is created. But if you move a file in the same volume, the file isn't physically moved. There is just a new link to the file. That's why permissions are preserved as default on move operations in the same volume.

This blog post explains the details:
http://blogs.msdn.com/oldnewthing/archi ... 17181.aspx

admin
Site Admin
Posts: 64886
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

MrSpock wrote:Well, security attributes are always reset when a file is created. If you copy a file or move it to a different volume, a new file is created. But if you move a file in the same volume, the file isn't physically moved. There is just a new link to the file. That's why permissions are preserved as default on move operations in the same volume.

This blog post explains the details:
http://blogs.msdn.com/oldnewthing/archi ... 17181.aspx
Ah, okay. Then this should do:

Code: Select all

    + Configuration | Advanced: Added option "Preserve permissions on 
      move operation". When checked (which is the default and was up to 
      now the hard-coded behavior) then the security attributes of files 
      are preserved when they are moved in the same volume. Uncheck it to 
      have the moved files inherit the security attributes of their new 
      folder.
Looks good?

MrSpock
Posts: 29
Joined: 07 Mar 2008 00:24

Post by MrSpock »

Perfect!

Post Reply