1.

Solve : how to find the file is empty or not??

Answer»

Hi,

i will receive lot of files EVERY day, is there any way, with which i can find the empty files or the files with less than 5 records.

thank you
vbscript
Code: [Select]Set objFSO = CreateObject("Scripting.FileSystemObject")
strMyFile = "c:\test\new.txt"
i=0
Set objFS = objFSO.GetFile(strMyFile)
If objFS.Size = 0 Then
WScript.Echo "0 size file: " & objFSO.GetFile(strMyFile).Name
Else
Set objFS = objFSO.OpenTextFile(strMyFile)
Do Until objFS.AtEndOfLine
objFS.ReadLine
i=i+1
Loop
WScript.Echo i
If i < 5 Then
WScript.Echo "File: " & strMyfile & " has less than 5 records "
End If
End If


save as script.vbs and on command line
Code: [Select]c:\test> cscript /nologo script.vbs
Hi,
this code is super, it works very GOOD, but can you help in ADDING few more things to it, LIKE can i give the directory path and work on all the file in the directory, and how can it get the email of this result.

thank youHi,

i will receive lot of files every day, is there any way, with which i can find the empty files or the files with less than 5 records.

thank you



Discussion

No Comment Found