Advertisement
Pearlfromsu

s4l2 0603232346

Mar 6th, 2023
963
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Configuration;
  6. using System.Threading.Tasks;
  7. using System.IO;
  8.  
  9. namespace s4l2 {
  10.    
  11.     class Program {
  12.         Queue<string> q;
  13.         List<string> getFilesList(string path) {
  14.             List<string> files = new List<string>();
  15.             if (!Directory.Exists(path))
  16.                 return files;
  17.  
  18.             Queue<string> q = new Queue<string>();
  19.             q.Enqueue(path);
  20.             while (q.Count > 0) {
  21.                 string current = q.Dequeue();
  22.                 foreach (string dir in Directory.GetDirectories(current))
  23.                     q.Enqueue(dir);
  24.                 files.AddRange(Directory.GetFiles(current));
  25.             }
  26.  
  27.             return files;
  28.         }
  29.  
  30.         static void Main(string[] args) {
  31.  
  32.             Console.WriteLine(ConfigurationSettings.AppSettings["path"]);
  33.             Console.ReadKey();
  34.         }
  35.     }
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement