Solved

Directory.CreateDirectory

Posted on 2010-08-19
1
470 Views
Last Modified: 2012-08-14
Using the above method of Directory.CreateDirectory(Path, Security). How can I retrieve the security from one directory and place it or copy it another?
0
Comment
Question by:thenrich
1 Comment
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 500 total points
ID: 33477488
You can use GetAccessControl to return DirectorySecurity about one directory and then use that in your call to CreateDirectory.
The example below obtains the security from the folder C:\Test then creates a new directory with the same security named C:\Test2

Dim dirSecurity As System.Security.AccessControl.DirectorySecurity = System.IO.Directory.GetAccessControl("c:\test")
System.IO.Directory.CreateDirectory("c:\test2", dirSecurity)

Open in new window

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question