Exemplo n.º 1
0
 private static void CreateTree(Folder folder)
 {
     try
     {
         string[] filesName = Directory.GetFiles(folder.Name);
         folder.AddFiles(filesName);
         var dirs = Directory.GetDirectories(folder.Name);
         foreach (var dir in dirs)
         {
             Folder newfolder = new Folder(dir);
             folder.AddChieldsFolders(newfolder);
             CreateTree(newfolder);
         }
     }
     catch (UnauthorizedAccessException)
     {
         Console.WriteLine("No access to this directory");
         return;
     }
 }