tags:

views:

651

answers:

3

I want to hide a file in c#. I know the file path and can create a FileInfo object.

How can I hide it?

+4  A: 
    FileInfo f = new FileInfo(myFileName);
    f.Attributes = FileAttributes.Hidden;
BFree
+14  A: 

File.SetAttributes("pathToFile",FileAttributes.Hidden)

Rajesh
+4  A: 

Try something like this:

FileInfo fi = new FileInfo(somefile);                
fi.Attributes = FileAttributes.Hidden;
Jeremy Cron