MorganGreylock
Programmer
I'm trying to automate a task that was given to me, to provide a list (text file output, but for now outputting to a textbox) of all files and folders on a drive, so that it can be cleaned up. So what I'd like to have is output like this:
T:\
T:\DirA
T:\DirA\DirA1
T:\DirA\DirA1\FileA1.txt
T:\DirA\DirA1\FileA2.txt
T:\DirA\DirB1
T:\DirA\DirC1 (these two are empty in this example)
T:\DirB
T:\DirB\DirD
T:\DirB\DirD\File1.txt
T:\DirB\DirD\File2.txt
T:\DirB\DirE
T:\DirB\DirE\File3.txt
etc. Hopefully you can see the pattern. A recursive list of folders, showing folders first, then files, for each subdirectory. I've been trying to use the For Each collections, but I keep getting hung up on the System Volume Information folder. I don't have read permission on this folder (network drive) and it kind of crashes the app. So I need to be able to test to see if I can change into a folder, print that folder path, then all the folders/files in it, then make a recursive call, etc until the last file has been displayed.
Any help would be greatly appreciated.
T:\
T:\DirA
T:\DirA\DirA1
T:\DirA\DirA1\FileA1.txt
T:\DirA\DirA1\FileA2.txt
T:\DirA\DirB1
T:\DirA\DirC1 (these two are empty in this example)
T:\DirB
T:\DirB\DirD
T:\DirB\DirD\File1.txt
T:\DirB\DirD\File2.txt
T:\DirB\DirE
T:\DirB\DirE\File3.txt
etc. Hopefully you can see the pattern. A recursive list of folders, showing folders first, then files, for each subdirectory. I've been trying to use the For Each collections, but I keep getting hung up on the System Volume Information folder. I don't have read permission on this folder (network drive) and it kind of crashes the app. So I need to be able to test to see if I can change into a folder, print that folder path, then all the folders/files in it, then make a recursive call, etc until the last file has been displayed.
Any help would be greatly appreciated.