Deleting directories

CryoEnix

Well-known member
Joined
Jan 11, 2003
Messages
93
Location
Wrexham, Wales
I know about the Kill() and RmDir functions, but RmDir only works if the folder is empty. Is there a special command to delete a folder, with contents or not?
 
CryoEnix said:
I know about the Kill() and RmDir functions, but RmDir only works if the folder is empty. Is there a special command to delete a folder, with contents or not?

Back in the day, you would use rmdir /s /q [dir], /q doesnt prompt user, and /s deletes all files and subdirectories.... Dont know how thatll help you, but the switches are there.
 
The Delete method of the Directory object has an overload that allows you to specify if you want a recursive delete, that also deletes the files and subfolders in the directory:
System.IO.Directory.Delete(String, Boolean)
 
Back
Top