Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » How to delete or empty a folder with VB6
Closed Thread
Old 02-24-2008, 08:20 AM   #1 (permalink)
 
Junior Techie

Join Date: Oct 2005

Posts: 63

RobertXYZ

Default How to delete or empty a folder with VB6

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.
RobertXYZ is offline  
Old 02-29-2008, 08:17 AM   #2 (permalink)
 
Newb Techie

Join Date: Nov 2007

Posts: 23

SpenceQ is on a distinguished road

Default Re: How to delete or empty a folder with VB6

Quote:
Originally Posted by RobertXYZ View Post
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
SpenceQ is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Folsder Refuses To Delete And Shadow Copies bluewasp Windows Operating Systems and Software 1 02-17-2008 08:07 AM
Cannot Delete A Folder. Cajete Windows Operating Systems and Software 7 02-03-2008 05:43 PM
Home Edition Troubles ChemicalMonkey Windows Operating Systems and Software 34 01-20-2008 09:26 PM
Unable to Delete Folder in Vista Grievearz Windows Operating Systems and Software 4 11-25-2007 09:48 PM
Corrupted Folder TriEclipse Windows Operating Systems and Software 3 06-12-2007 08:21 PM