0

How to synchronize file permissions between 2 files in .net core 3.0

This problem when I do make a automatic update progrom. I need to synchronize the previous file permissions to the updated file (It could also be a directory)

For example, the updated shell script needs to be consistent with the permissions of the previous shell script, otherwise it will not work (because the executable permission is missing)

I try to use GetAccessControl and SetAccessControl, but in macos, It throws NotSupportedException

var security = new DirectoryInfo(older).GetAccessControl();
new DirectoryInfo(newer).SetAccessControl(security);

What did i do wrong?

candycat
  • 435
  • 4
  • 13

0 Answers0