' 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& 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 |