public static void Main()
        {
            string directoryPath = "C:\\WINDOWS";

            Folder newFolder = new Folder(new DirectoryInfo(directoryPath).Name);
            TraverseDir(new DirectoryInfo(directoryPath), newFolder);

            double folderSize = TraverseSizeDir(new DirectoryInfo(directoryPath)) / (1024 * 1024);
            Console.WriteLine("Folder C files size: {0}", folderSize);

            TraverseFolder(newFolder);
        }
        private static void TraverseFolder(Folder newFolder)
        {
            try
            {
                var files = newFolder.Files;
                foreach (var file in files)
                {
                    Console.WriteLine("{0}=>{1}", file.Name, file.Size);
                }

                var children = newFolder.ChildFolders;
                foreach (var child in children)
                {
                    TraverseFolder(child);
                }
            }
            catch (Exception)
            {
            }
        }
 private static void TraverseDir(DirectoryInfo dir, Folder newFolder)
 {
     try
     {
         DirectoryInfo[] children = dir.GetDirectories();
         FileInfo[] files = dir.GetFiles();
         newFolder.Name = dir.FullName;
         foreach (var file in files)
         {
             newFolder.Files.Add(new File(file.Name, file.Length));
         }
         foreach (var child in children)
         {
             Folder folder = new Folder(child.Name);
             TraverseDir(child, folder);
             newFolder.ChildFolders.Add(folder);
         }
     }
     catch (Exception)
     {
     }
 }