using size variables on batch

Dell / GX520
January 5, 2009 at 09:59:00
Specs: Windows XP, Pentium 4 3.00GHz
Ok i'm kinda at a loss on this one guys. I'm trying to teach myself batch and vbscript for use at work. I ran into a problems. I have 2 reports that come out differently one (which I don't need) comes out consistently under 20KB and the other (which i'm needing) is over 100KB. I'm trying to figure out a way to either move or delete the file under 20KB so that I can grab the existing file (over 100KB) and automate the monarching of it. any help would be greatly appreciated.

Everything works fine until that small report comes out then my script will pull in the wrong file.

The report that I need comes out in the morning however the small report comes out about 6:00 pm or so, the only 2 files that are in the folder in the morning are 1 full sized report that I monarch and one small one which can be deleted. I would like to do this in batch without having to create a separate scheduled task to go delete the file after 6:00 when it runs.


See More: using size variables on batch

Report •


#1
January 5, 2009 at 10:41:02
@echo off & setLocal EnableDelayedExpansion

pushd c:\files

for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
if %%~Za lss 20000 move %%a d:\dest
)


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
January 5, 2009 at 11:48:35
You are the best that worked like a charm. Is there somewhere I can see the breaking down of the code so I can understand what makes it work like I see pushd defines the source folder but where does that syntax come from?

Report •

#3
January 5, 2009 at 11:59:21
You can get info with pushd /?

Same goes for:

if /?
set /?
for /?
dir /?
...


=====================================
If at first you don't succeed, you're about average.

M2


Report •

Related Solutions

#4
January 5, 2009 at 12:41:03
I greatly appreciate it. Saved me the heartache of setting up a scheduled task and hopeing it goes right.

Report •


Ask Question