

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Check if a File is hidden in C#
To retrieve the attributes of a file, use the FileAttributes Eumeration. It has various members like compressed, directory, hidden, etc.
To check if a file is hidden, use the hidden member name.
If the FileAttributes.hidden is set that would mean the file is hidden. Firstly, get the path to find the attributes.
FileAttributes attributes = File.GetAttributes(path);
If the following is set, that would mean the file is now hidden using the hidden member name.
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); Console.WriteLine("The {0} file is hidden.", path);
- Related Questions & Answers
- Check if a file is hidden in Java
- Determine if File or Directory is hidden in Java
- Check whether the file is hidden or not in Java
- How do I check if an element is hidden in jQuery?
- Check if a File exists in C#
- Check if a file exists in Java
- How to check if a file is a directory or a regular file in Python?
- Java Program to check if a file or directory is readable
- How to check if a file is connected with terminal in Python?
- How to check if a file exists in Golang?
- How to check if a file is readable, writable, or, executable in Java?
- How to check if the file is empty using PowerShell?
- Check if hidden files are displayed in the FileChooser or not in Java
- Check whether a file is a directory in Java
- How to open hidden file using C#?
Advertisements