Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string filepath = label4.Text;
- DirectoryInfo rootDir = new DirectoryInfo(filepath);
- FileInfo[] allFiles = null; try { allFiles = rootDir.GetFiles(); } catch { }
- foreach(KeyValuePair<string, string> ext in extensions)
- {
- try
- {
- foreach (FileInfo fi in allFiles)
- { if (extensions.ContainsKey(fi.Extension))
- { files.Add(fi.FullName.ToString()); label8.Text = fi.FullName; } }
- }
- catch (UnauthorizedAccessException)
- { }
- subDirs = rootDir.GetDirectories();
- foreach (DirectoryInfo dirInfo in subDirs)
- {
- try
- {
- foreach (string GFI in files)
- {
- label7.Text = Path.GetDirectoryName(GFI);
- label8.Text = Path.GetFileName(GFI);
- files.Add(GFI);
- label7.Text = "Directory";
- label8.Text = "File";
- }
- }
- catch (UnauthorizedAccessException) { }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment