2009-11-15 165 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