Hack Forums
[C#] Hide all files in a folder at once [every file in folder] [C#] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Hide all files in a folder at once [every file in folder] [C#] (/showthread.php?tid=5118025)



Hide all files in a folder at once [every file in folder] [C#] - FileBoss - Jan 1, 2016

Is it possible to hide say all .exe or all files in a folder of choice in c#? Like hide them all at once not searching for a particular file? Thanks for any replies


* - Nick (Name) - Jan 1, 2016

You can create a hidden folder and move files into it, not sure if this is what you're looking for but here is an example of how to do so...

Code
using System.IO;

string Filetohide = @"c:\hideme.exe";
string hiddenDir = @"c:\hiddenfolder";

if (!Directory.Exists(hiddenDir))
{
DirectoryInfo dirInfo = Directory.CreateDirectory(hiddenDir);
dirInfo.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
}

System.IO.File.Move(Filetohide, hiddenDir);



* - He B TeMy - Jan 2, 2016

http://stackoverflow.com/a/8132800/2990244

Same principle.