Advertisement
drkbl

C# processing files in a folder

Sep 17th, 2022
1,363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.34 KB | Source Code | 0 0
  1. DirectoryInfo myInfo = new DirectoryInfo(DbFolderPath);
  2. FileInfo[] myDbFiles = myInfo.GetFiles("*.db", SearchOption.TopDirectoryOnly);
  3. string myFileName;
  4. foreach (FileInfo item in myDbFiles) {
  5.     myFileName = Path.GetFileNameWithoutExtension(item.Name);
  6.     if (int.TryParse(myFileName, out int myDummy)) {
  7.         Result.Add(item.FullName);
  8.     }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement