Batch file needed

September 9, 2009 at 13:16:43
Specs: Windows XP, Intel Core 2/1.99 GB
I have an archive directory full of text files (.txt) that all start with the prefix harbil followed by a numeric sequence indicating the hour, minute and second they were created. These files contain data used by a software application and are collected daily in case the software crashes. Typically, the information is sent over one file at a time to the software directory at which time the information is taken from the text file by the application and placed in a queue. I have created a batch file that will take all the files from the archive directory, remove the numeric sequence and place them in the software directory in such a manner that they will all be named simply harbil.txt and overwrite one another as they are created. The problem is that only one set of information is added to the application queue, either the first or last file created (not sure). I believe I need to copy each file from the archive directory to the software directory one at a time with a pause in between in order to allow the software to grab the information before the file is overwritten. I have tried many times and failed. I cannot figure out how to loop the execution of the file copy to go one at a time and/or slow the process down. HELP!

See More: Batch file needed

Report •


#1
September 9, 2009 at 17:32:23
You need to be in the programming forum.

If I remember correctly adding commas between the file name adds a delay.

We were the unwilling, led by the unqualified, to do the unnecessary, for the ungrateful.

VietNam War Poster


Report •

#2
September 9, 2009 at 17:45:02
This should be posted in the Programming Forum on the right

http://ewen.uuuq.com/


Report •

#3
September 9, 2009 at 22:42:03
@echo off & setLocal EnableDELAYedExpansion

pushd d:\myapps

for /f "tokens=* delims= " %%a in ('dir/s/b/a-d habil*.txt') do (
copy %%a habil.txt
myprog habil.txt
)


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
September 10, 2009 at 05:50:14
Thanks, that worked however I am still having the same issue. The only information that the software application is grabbing from these text files is the last file that is copied into the directory. It still seems to be overwriting each file faster then the software can grab it.

Report •

#5
September 10, 2009 at 07:11:09
I don't have any idea what yuour software is doing.

But, as written, it will not do the next COPY until the excutable is done.

If the EXE is producing an output file and overwriting it, that's a separate issue.


=====================================
Helping others achieve escape felicity

M2


Report •

#6
September 10, 2009 at 07:24:59
Thanks for your help. The software that reads these text files is always running. The software drives an automated colorant dispenser. The text files are created by a second application which generates color formulas for tinting paint. The formulas are sent from the formulation software to the dispenser software via these text files, the formulation software creating and dropping these text files in a assigned directory. When the dispenser software detects the file, it reads it and adds the formula to the queue. When another formula is sent over, the new text file overwrites the pre-existing one, at which point the dispener software will once again grab the contents of the file and add it to the queue. Since the dispenser software has had an issue with crashing on occasion, I am backing up all of these text files into a second directory which I am attempting to then dump back into the dispenser software directory to repopulate the queue afterwards.

Report •


Ask Question