コード例 #1
0
        private static void RecursiveGetParentDirectories(ParsedPath rootPath, ref List<DirectoryInfo> dirs)
        {
            DirectoryInfo dirInfo = new DirectoryInfo(rootPath.VolumeAndDirectory);
            DirectoryInfo [] dirInfos = dirInfo.GetDirectories(rootPath.FileAndExtension);

            dirs.AddRange(dirInfos);

            if (!rootPath.IsRootDirectory)
            {
                RecursiveGetParentDirectories(rootPath.MakeParentPath(), ref dirs);
            }
        }
コード例 #2
0
        private static void RecursiveGetParentFiles(ParsedPath rootPath, ref List<FileInfo> files)
        {
            DirectoryInfo dirInfo = new DirectoryInfo(rootPath.VolumeAndDirectory);
            FileInfo [] fileInfos = dirInfo.GetFiles(rootPath.FileAndExtension);

            files.AddRange(fileInfos);

            if (!rootPath.IsRootDirectory)
            {
                RecursiveGetParentFiles(rootPath.MakeParentPath().VolumeAndDirectory.Append(rootPath.FileAndExtension), ref files);
            }
        }