Search code examples
c#wpfsecuritytemporary

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


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?


Solution

  • 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; 
    }