tags:

views:

61

answers:

1

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

+4  A: 

You need to add the following line before your "Loop" line:

filename5 = Dir

For an example, see: http://msdn.microsoft.com/en-us/library/aa262727(VS.60).aspx

jwanagel