Not a Member Yet,
Click here to Register
How do you like the new design?
It's cool, great job
[tally: 70%] 70%
It's okay
[tally: 20%] 20%
Its OK but I liked the old layout better
[tally: 0%] 0%
Please bring the old one back
[tally: 10%] 10%

votes: 10

ID: 317
Viewed: 2354
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Randy Birch
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Delete all Files in a directory (No Recursion)

Highlight all by clicking in box
<!---Declaration--->
'  Another UseNet posting by Randy Birch
'
Public Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Boolean
hNameMaps As Long
sProgress As String
End Type

Public Const FO_DELETE = &H3
Public Const FOF_SILENT = &H4
Public Const FOF_RENAMEONCOLLISION = &H8
Public Const FOF_NOCONFIRMATION = &H10
Public Const FOF_SIMPLEPROGRESS = &H100
Public Const FOF_ALLOWUNDO = &H40
Public Const FOF_FILESONLY = &H80&

Highlight All
<!---Code--->
Private Sub Command1_Click()

'!!!! warning: this will delete all files in the path specified without
notice !!!!

Dim sFiles As String
Dim SHFileOp As SHFILEOPSTRUCT

sFiles = "d:delete my contents*.*" & Chr$(0) & Chr$(0)

'set up the options
With SHFileOp
.wFunc = FO_DELETE
.pFrom = sFiles
.fFlags = FOF_FILESONLY Or _
FOF_SILENT Or _
FOF_NOCONFIRMATION Or _
FOF_ALLOWUNDO
End With

'delete them files!
Call SHFileOperation(SHFileOp)

End Sub;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions