vbs练习。。。- Set FSO = CreateObject("Scripting.FileSystemObject")
- For Each File In FSO.GetFolder("D:\test1").Files
- EXT = FSO.GetExtensionName(File)
- If LCase(EXT) = "txt" Or LCase(EXT) = "log" Then
- Size = Size + FSO.GetFile(File).Size
- End If
- Next
- If Size > 20 * 1024 * 1024 Then
- Result = "大于20MB"
- ElseIf Size = 20 * 1024 * 1024 Then
- Result = "等于20MB"
- Else
- Result = "小于20MB"
- End If
- MsgBox "大小:"&Size&" 字节"&vbCrLf&"结果:"&Result
复制代码
|