|
Answer» hello i would like to check a text file if it contains any text or rows. how to make it? i would like to make it by batch command.
thanksA file with no rows or text has no size. you can use dir and search for "0 bytes" using findstr in combination with for LOOP... or you can use vbscript Code: [Select]Set objFS = CreateObject("Scripting.FileSystemObject") strFile = "c:\test\test.txt" If objFS.GetFile(strFile).Size = 0 Then WScript.Echo "Zero Size " END If save the above as script.vbs and on command line : Code: [Select]c:\test> cscript /nologo script.vbs thanks very much!u can also use this in BAT file for /f "delims=" %%i in ('dir /b "path\*.txt"' ) do if %%~zi EQU 0 echo %%i have zero size
|