How to skip scan System Volume Information folder on C#

458 views Asked by At

Help, how to skip folder System Volume Information on disk D with C# and scan another folder.. here's the sample code

public void scDirectory(string location, string password)
{
    var validExtensions = new[]
    {
        ".ogg", ".mp3", ".txt"
    };

    string[] files = Directory.GetFiles(location, "*", SearchOption.AllDirectories);

    string[] chDir = Directory.GetDirectories(location, "*", SearchOption.AllDirectories);
    for (int i = 0; i < files.Length; i++){
        string extension = Path.GetExtension(files[i]);
        if (validExtensions.Contains(extension))
        {
            scFile(files[i],password);
        }
    }

    for (int i = 0; i < chdDir.Length; i++){
        scDirectory(chDir[i],password);
    }
}
0

There are 0 answers