Ejemplo n.º 1
0
        private IEnumerable <String> FindFiles(Directory directory)
        {
            if (directory != null)
            {
                foreach (Directory subDirectory in directory.Directories)
                {
                    foreach (String path in this.FindFiles(subDirectory))
                    {
                        yield return(path);
                    }
                }

                foreach (File file in directory.Files)
                {
                    yield return(file.Path);
                }
            }
        }
Ejemplo n.º 2
0
        private int CountFiles(Directory directory)
        {
            int count = 0;

            if (directory == null)
            {
                return(0);
            }

            foreach (Directory subDirectory in directory.Directories)
            {
                count += this.CountFiles(subDirectory);
            }

            count += directory.Files.Count();

            return(count);
        }