Friday, July 17, 2009

VB 6.0 code for delete all files in a folder

On Error Resume Next
MkDir App.Path & "\Temp"

DeleteAllFiles App.Path & "\Temp"

Public Function DeleteAllFiles(ByVal FolderSpec As String) As Boolean

Dim oFs As New FileSystemObject
Dim oFolder As Folder
Dim oFile As file


If oFs.FolderExists(FolderSpec) Then
Set oFolder = oFs.GetFolder(FolderSpec)
On Error Resume Next
For Each oFile In oFolder.Files
oFile.Delete True 'setting force to true
'deletes read-only file
Next
DeleteAllFiles = oFolder.Files.Count = 0
End If

End Function

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...