tags:

views:

47

answers:

3

Using VB6

I have the text file with different sizes, so i want to delete the file where filesize = 0 kb.

How to make a vb6 code for deleting the 0 kb files.

Need vb6 code Help

+2  A: 

You can use the FileLen function to check the file size.

jwanagel
+2  A: 

You can use the FileLen function. See here: http://www.vbforums.com/showthread.php?t=498720

Konamiman
+1  A: 

Try this function:

Sub DeleteZeroLengthFile(ByRef sFilePath As String)
' Inputs:  sFilePath        Filename or path name of file to be tested.
' Outputs: <None>
' In/Outs: <None>
' Errors:  Will raise error if file doesn't exist, is inaccessible, is locked, or user
'          doesn't have permissions.

    If FileLen(sFilePath) = 0 Then
        Kill sFilePath
    End If

End Sub

HTH,

Mark

Mark Bertenshaw