Skip to content

Instantly share code, notes, and snippets.

@imAliAsad
Created January 17, 2018 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imAliAsad/d94cfbc4af561531829149a4ee6b655e to your computer and use it in GitHub Desktop.
Save imAliAsad/d94cfbc4af561531829149a4ee6b655e to your computer and use it in GitHub Desktop.
C# don't show the hidden files
var dirs = Directory.GetDirectories(@"C:\")
.Select(d => new { Attr = new DirectoryInfo(d).Attributes, Dir = d })
.Where(x => !x.Attr.HasFlag(FileAttributes.System))
.Where(x => !x.Attr.HasFlag(FileAttributes.Hidden))
.Select(x => x.Dir)
.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment