コード例 #1
0
 public static void listFiles(string path)
 {
     if (Directory.Exists(path))
     {
         for (int i = 0; i < ShowContent.getHowManyPaths(path) - ShowContent.mainpathcount; i++)
         {
             Console.Write("----");
         }
         ShowContent.directoryInfo = new DirectoryInfo(path);
         Console.WriteLine("+" + ShowContent.directoryInfo.Name);
         ShowContent.folders++;
         foreach (string item in Directory.GetFileSystemEntries(path))
         {
             ShowContent.listFiles(item);
         }
     }
     else if (File.Exists(path))
     {
         for (int i = 0; i < ShowContent.getHowManyPaths(path) - ShowContent.mainpathcount; i++)
         {
             Console.Write("----");
         }
         ShowContent.fileinfo = new FileInfo(path);
         Console.WriteLine(ShowContent.fileinfo.Name + " - " + ShowContent.fileinfo.LastAccessTimeUtc.ToString() + " - " + ByteConverter.convert(ShowContent.fileinfo.Length));
         ShowContent.files++;
         ShowContent.totalsize += ShowContent.fileinfo.Length;
     }
 }