Creating hidden folders
CreateHiddenFolder(string name)
{
DirectoryInfo di = new DirectoryInfo(name);
di.Create();
di.Attributes |= FileAttributes.Hidden;
}
Yes you can. Create the directory as normal then just set the attributes on it. E.g.
DirectoryInfo di = new DirectoryInfo(@"C:\SomeDirectory");
//See if directory has hidden flag, if not, make hidden
if ((di.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
{
//Add Hidden flag
di.Attributes |= FileAttributes.Hidden;
}
using System.IO;
string path = @"c:\folders\newfolder"; // or whatever
if (!Directory.Exists(path))
{
DirectoryInfo di = Directory.CreateDirectory(path);
di.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
}