|
-
Oct 24th, 2002, 06:53 PM
#1
Thread Starter
Hyperactive Member
Deleting all files in a folder [RESOLVED]
Hi Guys,
I want to delete the contents of a directory and i don't really know how to go about doing that. The directory may or may not contain files and it will contain an unknown number of files.
Any help would be greatly appreciated.
Last edited by Blinky Bill; Oct 24th, 2002 at 07:14 PM.
We don't know what's wrong. . . So the best bet might be to remove something surgically.
-
Oct 24th, 2002, 07:03 PM
#2
VB Code:
On Error Resume Next
Kill "C:\SomeDir\*.*"
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Oct 24th, 2002, 07:04 PM
#3
Lively Member
File System Object
The FileSystemObject would be the easiest way although it will require a reference to the scrrun.dll.
VB Code:
Private Sub KillFiles()
Dim fso as FileSystemObject
Dim myFolder as Folder
Dim myFile as File
Set fso = new FileSystemObject
Set myFolder = fso.GetFolder(<FolderPath Here>)
For Each myFile in myFolder.Files
myFile.Delete(True)
Next myFile
End Sub
try that out..
-
Oct 24th, 2002, 07:13 PM
#4
Thread Starter
Hyperactive Member
Thanks crptcblade. Too simple a solution to have occured to me.
We don't know what's wrong. . . So the best bet might be to remove something surgically.
-
Oct 24th, 2002, 07:20 PM
#5
Good Ol' Platypus
If you want another piece of code:
VB Code:
Shell "Kill C:\SomeDir\*.*"
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Oct 24th, 2002, 07:28 PM
#6
Thread Starter
Hyperactive Member
Sastraxi, Isn't that pretty much the same code crptcblade posted?
We don't know what's wrong. . . So the best bet might be to remove something surgically.
-
Oct 24th, 2002, 08:25 PM
#7
Good Ol' Platypus
Yeh, but meh. Just stating that you can still use the commandline, even though it's Windows
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
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
|