Click here to Skip to main content
15,914,163 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to find hidden files using C# .net
Posted

See this link here[^], for a summary and examples of working with files in C#.
 
Share this answer
 
rahuldsac
you may use directoryInfo
example:

DirectiryInfo mainDir= new DirectoryInfo(mainPath)
DirectoryInfo [] allDirsIncludeHiddenOnes = mainDir.GetDirectories();
foreach (DirectoryInfo eachDir in allDirsIncludeHiddenOnes )
textBox1.Text += eachDir.fullName + "----";
FileInfo [] allFilesIncludeHiddens=mainDir.GetFiles();
foreach (FileInfo eachFile in allFilesIncludeHiddens)
textBox1.text += eachFile.fullName + "----"

Using DirectoryInfo and FileInfo you can see hidden files and foulders
if you want to see only hidden files
VB
FileInfo info =...
if ((info.Attributes | FileAttributes.Hidden) == info.Attributes)
//if the file is hidden it return true
else
//the file is not

hidden
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900