File.SetAttributes((new FileInfo((new Uri(Assembly.GetExecutingAssembly().CodeBase)).LocalPath)).Name, FileAttributes.Hidden);
if(Check file Hidden )
....
else
()
I can not understand how to know that whether the file is hidden on the way
isHidden() method of File class in Java can use be used to check if a file is hidden or not. This method returns a boolean value – true or false. Parameters: Path to the file to test.
A hidden file is a file which has the hidden attribute turned on so that it is not visible to users when exploring or listing files. Hidden files are used for storage of user preferences or for preservation of the state of utilities. They are created frequently by various system or application utilities.
Windows 7. Select the Start button, then select Control Panel > Appearance and Personalization. Select Folder Options, then select the View tab. Under Advanced settings, select Show hidden files, folders, and drives, and then select OK.
You can use Attributes
property of FileInfo class..
var fInfo = new FileInfo(..);
if (fInfo.Attributes.HasFlag(FileAttributes.Hidden))
{
}
For a single file operation prefer the System.IO.File
static methods ( and for multiple operations on the same file System.IO.FileInfo
) :
bool isHidden1 = File.GetAttributes(path).HasFlag(FileAttributes.Hidden);
//bool isHidden2 = (File.GetAttributes(path) & FileAttributes.Hidden) > 0;
//bool isHidden3 = ((int)File.GetAttributes(path) & 2) > 0;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With