Click to See Complete Forum and Search --> : Delete Folder with files and subfolders
rockies1
Nov 8th, 1999, 10:31 PM
I need to delete a folder that has files in it and sub folders with files in them...etc...
How can I delete the parent folder and all the subfolders and files in it without deleting the individual files first?
------------------
Morgan
rockies1@gvi.net
My Web Page (http://members.xoom.com/Rockies1)
smalig
Nov 8th, 1999, 10:33 PM
RmDir dir1
------------------
smalig
smalig@hotmail.com
smalig.tripod.com (http://smalig.tripod.com)
rockies1
Nov 8th, 1999, 10:38 PM
RmDir won't delete a directory with files in it...
This Directory has anywhere from 20-50 subdirectories in it each with countless files in them...
------------------
Morgan
rockies1@gvi.net
My Web Page (http://members.xoom.com/Rockies1)
Aaron Young
Nov 8th, 1999, 10:43 PM
Try the FileSystemObject, eg.
Dim oFSO As Object
Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.DeleteFolder "C:\Test", True
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net
rockies1
Nov 8th, 1999, 10:55 PM
Ah Ha!! I had tried:
oFSO.DeleteFolder "C:\Test"
But it didn't work...
Then I tried your
oFSO.DeleteFolder "C:\Test", True
and it worked...
Thanks!!!
------------------
Morgan
rockies1@gvi.net
My Web Page (http://members.xoom.com/Rockies1)
Serge
Nov 9th, 1999, 12:06 AM
Yes, the second parameter indicates where the files or folders in that folder should be removed.
Regards,
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
Howard Stern
Nov 9th, 1999, 06:47 AM
why not Kill(path) ?
that would work wouldnt it?
CodeJunkiee
Jan 12th, 2000, 06:33 PM
Sorry Howard, the kill is for single files only
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.