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
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.
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.
Summary: I am designing a website in java and I would like the size of the screen to adjust to the size of the users screen. The website is designed to use the full screen size with no tool bars or menu bars....
Summary: Is it possible to use a Variable in another Variable? For instance, in my batch file I have SET /p UCode= * Example: * SET /p UCode=Cas123 Cas123 will be a random number/code, specific to the user....
Summary: cypster, 1. for %%a in (*.txt) do ( 2. >%%a.# echo Good Morning 3. >>%%a.# type %%a 4. move/y %%a.# %%a 5. ) Explanation: 1. For every *.txt, execute all the commands until the "(" bracket is...