Question:
I want to delete and entire directory tree. I do not knowhow big the directory is, how many sub-dirs that it has, etc.I am not using a form and listing directories, this is somecode in a module. All I know is the name of the top directory.
Answer:
The DOS command to do this is “deltree”. If you do a Shell statement to COMMAND.COM, you can run that command on the directory. For instance, the code you would want to do is this: Shell “COMMAND.COM /C DELTREE C:WINDOWS”. (That example could be a bit dangerous, but you get the idea.)I believe there might be API calls to do this, but you’d have to be careful with versioning if you were planning on releasing a 16- and 32-bit version of the program.The hard way to do it (if you wanted to be sure) is to write a recursive directory search that goes through and uses the “Kill” statement and the “RmDir” function to delete any files in a directory and then remove it.You might be able to fake something like this by using a hidden drive/dir/filelist box combination.