Is there a way to create folders with security in c#?

263 views Asked by At

I'm trying to create a temporary folder, but this folder has to be unerasable and the files inside it too.

is there a way to do it using c# and WPF?

1

There are 1 answers

2
David J Barnes On BEST ANSWER

I think your best bet is to make a hidden folder using:

using System.IO; 

string path = @"c:\newHiddenFolder";
if (!Directory.Exists(path)) 
{ 
  DirectoryInfo di = Directory.CreateDirectory(path); 
  di.Attributes = FileAttributes.Directory | FileAttributes.Hidden; 
}