VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A Delete All files in a Directory and then Delete the DIrectory A

by David Stewart Williams (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (23 Votes)

Code Deletes a File and Directory, Note YOu DOnt Have to Reference Ms Scripting Runtime Please Vote for me if this helps you out or if you think it is a good code!!!!! Thank you Sean For letting me know you don't Have to reference Ms Scripting

Rate A Delete All files in a Directory and then Delete the DIrectory A

'you can't just delete an exe with this by itself but it can delete an exe in a directory
'Please vote if you like this code!!
Public Sub DelAll(ByVal DirtoDelete As Variant)
Dim FSO, FS
Set FSO = CreateObject("Scripting.FileSystemObject")
FS = FSO.DeleteFolder(DirtoDelete, True)
End Sub
'so like
Private Sub Command1_Click()
Call delall("c:\") 
'that would delete the c:\ drive
End Sub
'if you need more help e-mail me at 
'[email protected]

Download this snippet    Add to My Saved Code

A Delete All files in a Directory and then Delete the DIrectory A Comments

No comments have been posted about A Delete All files in a Directory and then Delete the DIrectory A. Why not be the first to post a comment about A Delete All files in a Directory and then Delete the DIrectory A.

Post your comment

Subject:
Message:
0/1000 characters