Search found 345 matches

by Samir
03 Nov 2015 14:59
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5066

Re: Optimizing These Loops

I don't know if the following is much faster, but you could try to avoid using environment variables (instead this uses a tempfile; not tested): @echo off setlocal :: ... set current date ... >list.temp ( for %%f in ("DAY*.RPT" "PLU*.RPT" "SKU*.RPT" "*.txt") ...
by Samir
03 Nov 2015 14:25
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5066

Re: Optimizing These Loops

I think the only way a singular loop might be faster is if it stopped working once all three files were found. You could jump out. SET "DAY="&SET "PLU="&SET "SKU=" FOR %%f IN (*.RPT) DO ( SET "filedatetime=%%~tf" SET "file=%%f" IF "!fil...
by Samir
03 Nov 2015 13:43
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5066

Re: Optimizing These Loops

Kinda ironic when you're telling me about being 'behind' and we're essentially talking on a site about DOS batch files--an operating system that's been extinct now since windows 98. You are incorrect. We are not talking about DOS batch files. We are talking about Windows (NT) batch files which are ...
by Samir
03 Nov 2015 09:51
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5066

Re: Optimizing These Loops

Thank you for the many solutions. I'll parse through them when I get a chance. Maybe Robocopy would be faster at finding them. On the systems where this executes, it's not installed. That was actually my first inclination. Or maybe outputting the directory to a file if that can be searched faster. U...
by Samir
02 Nov 2015 17:51
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5066

Re: Optimizing These Loops

Squashman wrote:Maybe Robocopy would be faster at finding them.
On the systems where this executes, it's not installed. :( That was actually my first inclination. Or maybe outputting the directory to a file if that can be searched faster.
by Samir
02 Nov 2015 17:46
Forum: DOS Batch Forum
Topic: Conditional Actions Using Data From Text File
Replies: 20
Views: 4660

Conditional Actions Using Data From Text File

I have several text files that on line 8 either have text that I can use in a conditional to execute something, or are blank, which indicates another action needs to be taken. What's a good methodology for this? Here's some example files to work with: FILE TYPE 1 ------------------------------------...
by Samir
02 Nov 2015 16:53
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5066

Re: Optimizing These Loops

I see. Not sure if that would increase the performance but at least something you could try FOR %%f IN (*.RPT) DO ( SET "filedatetime=%%~tf" SET "file=%%f" IF "!filedatetime:~0,10!"=="%currentDate%" ( IF /I "!file:~,3!"=="DAY" ( SET "...
by Samir
02 Nov 2015 16:27
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5066

Re: Optimizing These Loops

aGerman wrote:Does %currentDate% contain the current date?
It can, but it is usually a day or two before, and could be one in the past few months from current. It is always in the format of MM/DD/YYYY.
by Samir
02 Nov 2015 16:05
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5066

Optimizing These Loops

I have the current segment of code: :REPORTSTART FOR %%f IN (DAY*.RPT) DO ( SET filedatetime=%%~tf REM ECHO !filedatetime! IF "!filedatetime:~0,10!" == "%currentDate%" SET DAY=%%f REM ECHO !DAY! ) FOR %%f IN (PLU*.RPT) DO ( SET filedatetime=%%~tf REM ECHO !filedatetime! IF "...
by Samir
02 Nov 2015 15:09
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3308

Re: Massaging Textual Data

Worked great!
by Samir
02 Nov 2015 15:01
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3308

Re: Massaging Textual Data

@echo off &setlocal set "txt_in=TOTLSOLD" set "txt_out=TOTLSOLD.TXT" set "txt_fuel=FUEL.TXT" set "skip=128" set "n=0" set "fuel=" setlocal EnableDelayedExpansion <"!txt_in!" >>"!txt_out!" ( for /l %%i in (1 1 %skip%...
by Samir
02 Nov 2015 10:18
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3308

Re: Massaging Textual Data

Everything works great, so now I've moved onto another segment of my task that requires other information to be extracted. But I noticed the same data I need is actually created by this batch--specifically second column in these lines: Unl-Self 1752.757 4555.44 Ul-Plus-Self 84.941 234.36 Supreme-Sel...
by Samir
31 Oct 2015 16:17
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3308

Re: Massaging Textual Data

I'm saying that sometimes the system might mess up. Hmm. Your implementation is an AND connective. I assume you should better write an OR connective which can be simplified in your case if "%%j%%k" neq "00.00" ( You're right! I forgot that an inverted AND is an OR. Good catch! I...
by Samir
31 Oct 2015 15:58
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3308

Re: Massaging Textual Data

Are you saying that an amount of 0 could cost more than 0 or an amount of more than 0 could be for free? I'm surprized. I'm not sure if the .00 is relevant since it will probably be dropped if there's only an arithmetic comparison occurring. There is no numeric value in Batch that includes a point....
by Samir
31 Oct 2015 15:12
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3308

Re: Massaging Textual Data

Everything works well. One other change that I wanted to do was to make sure that not only was an amount 0, but also the price 0.00 before removing the line. I'm thinking that changing this: if "%%j" neq "0" ( to this should do it? if "%%j" neq "0" if "%%...