Computing.Net > Forums > Programming > using size variables on batch

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

using size variables on batch

Reply to Message Icon

Name: scrappy1855
Date: January 5, 2009 at 09:59:00 Pacific
OS: Windows XP
CPU/Ram: Pentium 4 3.00GHz
Product: Dell / GX520
Subcategory: Batch
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: January 5, 2009 at 10:41:02 Pacific
Reply:

@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


0

Response Number 2
Name: scrappy1855
Date: January 5, 2009 at 11:48:35 Pacific
Reply:

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?


0

Response Number 3
Name: Mechanix2Go
Date: January 5, 2009 at 11:59:21 Pacific
Reply:

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


0

Response Number 4
Name: scrappy1855
Date: January 5, 2009 at 12:41:03 Pacific
Reply:

I greatly appreciate it. Saved me the heartache of setting up a scheduled task and hopeing it goes right.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: using size variables on batch

Screen Size Variable www.computing.net/answers/programming/screen-size-variable/5424.html

Use a Variable as part of another Variable www.computing.net/answers/programming/use-a-variable-as-part-of-another-variable/19787.html

Another batch delight! www.computing.net/answers/programming/another-batch-delight/17551.html