Possible Duplicate:
C# – Get a list of files excluding those that are hidden
How do i make sure that i only get the folders that are NOT hidden?
this is what i do know but it returns all folders.
string[] folders = Directory.GetDirectories(path);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use DirectoryInfo to check if a folder is hidden:
Another solution would be the following one-liner:
In this case
foldersis anIEnumberable<DirectoryInfo>.If you want files instead of directories, simply replace GetDirectories with GetFiles.