|
-
Sep 14th, 2001, 08:56 AM
#1
Thread Starter
Lively Member
Deleting a folder and all of it's contents
How do I do this?
I know that I could loop through each and every folder deleting each file using the Kill method, but this would be a pain. Is there any way to do this better?
Flustor
-
Sep 14th, 2001, 08:58 AM
#2
You could always use Deltree, which I believe deletes every file in every folder (subdirectories).
VB Code:
Shell "command.com Deltree /Y C:\MyFolder\Stuff\MoreStuff\*.*
-
Sep 14th, 2001, 08:58 AM
#3
Frenzied Member
You can use the File System Object and I think that it will delete the folder along with the files.
-
Sep 14th, 2001, 09:11 AM
#4
Thread Starter
Lively Member
Excellent!! I'll give that a try.
thanx!
-
Sep 14th, 2001, 09:25 AM
#5
Thread Starter
Lively Member
I've just found that Microsoft (in their infinate wisdem) have dumped Deltree. One of my favorates in the days of Dos 6.
So that shell command doesn't work! Good idea though (which I'll be using in future).. any others?
-
Sep 14th, 2001, 09:52 AM
#6
Fanatic Member
VB Code:
Dim fso As New FileSystemObject
If fso.FolderExists Then fso.DeleteFolder ("C:\Temp")
You need the Microsoft Scripting Runtime in your references.
You could technically do a recursive kill feature and kill *.* in every sub directory then kill each subdirectory then the directory you wanted to kill, but this is much more convenient.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|