VB.Net Code to Delete all subfolders and files
Posted on 2011-09-27
I have a folder that contains a lot of files, subfolders and files in the subfolders.
I do not want to delete the parent/top level folder, i just want to delete all the files, subfolders, and files each subfolder contains.
All the code I have seen on the internet and EE allows you to specify the path/parent/top level folder, but it deletes the parent/top level folder that you specify, in addition to all subfolders and files.
That wont work for me, I need to specify a parent folder, but only the files, subfolders, and files in the subfolders get deleted, not the parent folder itself.
Could someone provide me with the VB.Net code that will allow me to delete just the files, subfolders, and files in the subfolders while leaving the top level/parent folder intact?.