Deleting whole durectories...
Hi,
my app creates a directory and puts some subdirectories in it with some files. When the app exits I want to delete all the directories.
I looked at the kill and rmdir command, but kill can only be used on files and rmdir doesn't do subdirectories.
Anybody got any ideas?
Thanks
Re: Deleting whole durectories...
use the FileSystemobject
Dim fso
set fso = CreateObject("Scripting.FileSystemObject")
Dim filespec as string
filespec = "c:\schrott\test"
fso.DeleteFolder filespec, true
Re: Deleting whole durectories...
small improvement:
Dim fso as Scripting.FileSystemObject
set fso = new Scripting.FileSystemObject
Dim filespec as string
filespec = "c:\schrott\test"
fso.DeleteFolder filespec, true
use early binding: add a reference to "microsoft scripting runtime" to your vb project.
and yes, it does delete subfolders.