Hiding a File/Directory
Hi, How to hide a file/Directory Through C#.Net.
Please give me solution.Hiding a folder using Below solutions,The folder is visible when you change the property in view tab (OR) When you search with a criteria in that particular drive or directory.
Kirtan PatelPosted Oct 15, 2009, 7:18 AM
attribe command
attrib +s +h +r c:\test
you can execute this programatically also
Kirtan PatelPosted Oct 13, 2009, 10:29 AM
Here is Complete Code for Both Directory And File Hiding :)
private void btnHideDirectory_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK)
{
string SelectedDirectory = fbd.SelectedPath;
File.SetAttributes(SelectedDirectory, FileAttributes.Hidden);
}
}
private void btnHideFile_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if(ofd.ShowDialog() == DialogResult.OK)
{
string FiletoHide = ofd.FileName;
File.SetAttributes(FiletoHide, FileAttributes.Hidden);
}
}
Dushan StankovicPosted Oct 13, 2009, 9:51 AM
For directory it is: