|I'm trying to use batch file to find the numbe rof lines in a file if it matches it would copy that particular file. for example, if a.txt has got zero lines it would copy a.txt to another directory.|
I've got a script below but I'm not sure how can I copy that file.
Script Test 1
@echo off & setLocal EnableDELAYedeXpansion
Set filename= C:\SAP\Outbox\ORD_SG_201108*.ASC
for /f "tokens=1 delims=" %%a in ('find /v /c "" %filename%') do (echo %%a)
Script Test 2
Set filename= C:\SAP\Outbox\ORD_SG_2011*.*
set /a cnt=0
for /f %%a in ('type %filename% ^|find "" /v /c') do (echo %filename% has %%a lines)
if %CNT% equ 0 copy %filename% %destination%
I tested with the above and it copies all the files.
Please help me, i'm new to batch file. Any help or suggestion would be greatly appreciated.