Thursday, April 21, 2011

Why is My Loop Only Deleting One File?

Using VB6

In a folder, i have n number of files, i want to delete a 0 kb files

code

Dim filename5 As String
filename5 = Dir$(txtsourcedatabasefile & "\*_*", vbDirectory)
MsgBox filename5
Do While filename5 <> ""
    If FileLen(txtsourcedatabasefile & "\" & filename5) = 0 Then
        Kill txtsourcedatabasefile & "\" & filename5
    End If
Loop

txtsourcedatabasefile - path

The above code is deleting a only one file, remaining file is not deleting. Showing Error as file not found.

What wrong in my code?

Need VB6 code Help

From stackoverflow

0 comments:

Post a Comment