Click to See Complete Forum and Search --> : simple deltree question


November 4th, 1999, 01:07 PM
i hope someone can help me out here,
i wrote this in an old batch file,
deltree/y c:\windows\tempor~1
how can i write that same thing in vb?
Thanks,
Ele

Aaron Young
November 4th, 1999, 05:59 PM
You have a couple of options:

You could run the same batch file via the Shell Command, eg.
Shell "BatchFile.bat"

You could use the Kill and RmDir Functions to Systematically Remove the Directory Structure.

Perhaps the easiest to implement would be to use the FileSystemObject from the Scripting Runtime Library, eg.

private Sub Command1_Click()
Dim oFSO as Object
set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.DeleteFolder "Directory Path Here"
set oFSO = nothing
End Sub




This Method will Remove the Specified Directory and any Files or Sub Directories there in.

Aaron Young
Analyst Programmer
adyoung@win.bright.net
aarony@redwingsoftware.com