Quote:
Originally Posted by RobertXYZ I am looking for a code which could either completely delete a folder or
delete all files in this particular folder.
Your help is appreciated. |
I'm surprised VB has nothing to help you. I haven't used BASIC in decades, and used VBasic years ago, but I'm now into Delphi and VFoxpro because of the limitations on platforms that were an issue back then.
But if memory serves me, Basic has standard file commands, CHDIR,FILES,MKDIR,NAME,RMDIR,etc. Now maybe some may have been taken out of the VBasic suite for secure reasons, I can't really say.
There is an alternative:
If your OS is Win, you can shell to DOS (RUN dir > <filename> .or. RUN <filename.BAT>) and use standard dos commands such
as:
CD\
b:
DIR
copy ......
dir > OutFile
..... you can also put the commands in a Batch file (.BAT) and "RUN" that from a shell. (see RUN statement in VB).
In testing, create some empty folders in heirarchy form and test these. Don't use any delete commands until you know your program is running properly. Keep in mind some commands may not work because of some file attributes making them secure. You will need to consider this as well.
At one time DOS's..... DelTree /S ....was allowed even in Win 9x systems, but in XP it's taken out, (not sure about NT or 2000). This is because Win's OS had no control of file management and I suppose presented security issues when the operator did this. MS is starting to slowly restrict use of DOS by it's users. Also, unrestricted, any Net user can remotely submit the command for execution on your PC wiping out your info.
see Windows help: 1/
Command Shell Overview (these are the parameters Spy raiders like to use to find out about your PC's configuration.)
2/
Batch Files
3/
Command-Line Reference A-Z
Spence