Search code examples
c#.netpermissionsdirectoryhidden

How to find all files, including hidden and system files


I need to create a full list of the files and sub-directories in a directory.

DirectoryInfo.GetFiles() does NOT find all files; hidden files, at a minimum, seem to be missing.

(There may also be a problem with permissions, as I can't look inside some directories using Windows Explorer, even though I am running as Administrator. For instance, "C:\System Volume Information" can not be entered.)

I am using C#, Windows XP Pro


Solution

  • DirectoryInfo.GetFiles() returns all files (excluding those that you don't have permission to see).

    At the very least it definitely does include hidden files, as shown by this person who is asking almost exactly the reverse of this question.

    Do you have a specific example of a file that appears elsewhere but not in this list?