StoryTeller.Persistence.FileSystem.GetSubFolders C# (CSharp) Метод

GetSubFolders() публичный Метод

public GetSubFolders ( string folderPath ) : string[]
folderPath string
Результат string[]
        public string[] GetSubFolders(string folderPath)
        {
            if (!Directory.Exists(folderPath))
            {
                return new string[0];
            }

            string[] strings = Directory.GetDirectories(folderPath);
            var suiteFolders = new List<string>();
            foreach (string folder in strings)
            {
                var dir = new DirectoryInfo(folder);

                //Ignore directories that are hidden that have other FileAttributes
                if (
                    (dir.Attributes & (FileAttributes.Hidden | FileAttributes.Directory)) ==
                    (FileAttributes.Hidden | FileAttributes.Directory))
                {
                    continue;
                }

                suiteFolders.Add(folder);
            }

            return suiteFolders.ToArray();
        }

Usage Example

Пример #1
0
        public void ReadDirectory(string directory)
        {
            Console.WriteLine("Searching directory {0} for samples", directory);
            var system = new FileSystem();
            system.GetFiles(directory, "cs").Each(f => readFile(f));

            system.GetSubFolders(directory).Each(dir => ReadDirectory(dir));
        }