Deleting a Directory Tree

Deleting a Directory Tree

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.

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved