Richard Banks
Richard Banks

Reputation: 2983

copying folders and preserving permissions

Guys ive been tasked with creating an app that will create a bunch of folders with permissions on our network in a share specified by the user. My thoughts are to create the folders as a template with all the necessary permission and then the app will simply copy the template to the specified share. Is it possible to in C# or powershell to copy the folders and preserve the permissions when doing so. Ive done a google search but cant find anything conclusive.

Upvotes: 2

Views: 2242

Answers (1)

Pedro Ferreira
Pedro Ferreira

Reputation: 649

There you go, simple use the class FileSecurity to transfer permissions of files.

Google first result on c# copy files maintain permissions

And Directory Security for the folders:

Directory Security 1

Directory Security 2

Upvotes: 1

Related Questions