2009-11-15 77 views
1

使用VB6如何檢查文件大小?

我有不同大小的文本文件,所以我想刪除filesize = 0 kb的文件。

如何製作一個用於刪除0 kb文件的vb6代碼。

需要VB6代碼幫助

+0

爲什麼你會使用VB6?遺產代碼? – 2009-11-15 09:21:22

回答

1

試試這個功能:

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