Is actually quite simple. It is used System.IO. Then you have two methods to delete. First delete files from other directories. Necessarily if you delete the folders you delete the files they contain.
Deleting a file:
Code:
PATH = @"c:\my folder\my subfolder\dir1\dir2\myfile.txt";
File.Delete(PATH);
Remove directory:
Code:
PATH = @"c:\my folder\my subfolder\dir1\";
Directory.Delete(PATH);
After assuming full path, you must excerpts directory path, for example through the split.
Code:
String _Dir1= PATH.Split('\\')[3];
Bookmarks