Saturday, 15 March 2014

windows - Read in values from a text file and output certain values -



windows - Read in values from a text file and output certain values -

i working out custom backup scripts , lastly bit want has me stumped.

searched through posts , didn't quite find solution trying do.

i need read in values form text file result of command creating list of every zip file in activebackup dir along size

forfiles /p f:\activebackup /s /m *zip /c "cmd /c echo @fname @fsize" > c:\scripts\output\filesize.txt

output pretty much:

server_name1-date.zip 23454623 server_name2-date.zip 7862457 server_name3-date.zip 22 server_name4-date.zip 98 etc

i need read in of entries (for loop?) , output lines size 100 or less. able utilize output variable variable (based on date above) server_name3-date.zip 22, server_name4-date.zip 98.

this way can utilize variable in job generates existing email added line like:

echo next zips small: %value_too_small%

thanks guidance , examples in advance!

give test. batch math fails on 2gb sizes might work lower sizes.

forfiles /p f:\activebackup /s /m *zip /c "cmd /c if @fsize leq 100 echo @fname @fsize" > c:\scripts\output\filesize.txt

windows shell batch-file scripting

No comments:

Post a Comment