Automatically naming files in Win 2K

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

I am sorry to say that this is a boring work related
question. I will give a small bit of background before I
get to the relevant bit.

We have a production line which is run using a RSLOGIX
PLC. This line also has 6 WIN 2K PC's which run/control a
vision system each. Each of these Vision system
applications adds to various logs on each of the PC's as
the production line is running. These logs are started at
00.00 hours every day and by the end of the 24 hour period
there could be 4 different log files, each of which are
over 3-4 Mb of a text file. The problems occur as the
Vision application tries to close these huge files and
create a new empty log file with a different date in the
title name. This hangs the Vision applicattion and
sometimes the PC. This costs about 10 minutes downtime
spread across every line at the same time. I have changed
the PC time of each different PC on the line to stagger
the effect that would occur if all of these PC's were to
hit 12 midnight at the same time but it still causes us
grief. The question I am asking is the following -


Can I write a macro/program which will be able to
automatically rename these text logfiles at a time which
would be referenced to the real time on the PC clock. This
means that the Vision applicattion will not be closing
these huge files, but explorer would. And this I hope
would prevent the hanging of the PC's

Any help
 
Richard wrote:

Can I write a macro/program which will be able to
automatically rename these text logfiles at a time which
would be referenced to the real time on the PC clock. This
means that the Vision applicattion will not be closing
these huge files, but explorer would. And this I hope
would prevent the hanging of the PC's

Any help

Yes, you can automatically rename the files by running a
batch file through the Task Scheduler at a predetermined
time. What should the new names of the files be?
 
The batch file should be able to figure out what date it
is on the PC. Then it should be able to locate the 4-5 log
files in question on the HDD and rename them simply by
adding OLD at the start or the end of the original name of
the file. This does not affect the date collection as all
the info is still available to the user in the event of a
machine problem.

EG.
Current filename is "PLCIOLOG_03"
I want this renamed to "PLCIOLOG_03_OLD"

The system keeps these files for a period of 1 calendar
month and then overwrites them. Each day of a month has a
log which is saved to a file with the date of that day in
the filename as above. At then end of the month I will
have 30/31 Logfiles which should be called PLCIOLOG_01_OLD
up to PLCIOLOG_31_OLD. These will be the "BIG" files
because these will have their name changed at say 23-30
Hrs to make sure the LOG being saved at midnight is as
small as possible to reduce the chances of hanging the PC.

Am I sounding a bit long winded

THKS
 
Richard said:
The batch file should be able to figure out what date it
is on the PC. Then it should be able to locate the 4-5 log
files in question on the HDD and rename them simply by
adding OLD at the start or the end of the original name of
the file. This does not affect the date collection as all
the info is still available to the user in the event of a
machine problem.

There is no problem for a batch file to figure out what date
it is on the PC.

for /f "tokens=3 delims=/ " %%a in ('date /t') do set day=%%a
EG.
Current filename is "PLCIOLOG_03"
I want this renamed to "PLCIOLOG_03_OLD"

Well, this is pretty easy:

if exist PLCIOLOG_%day%_OLD del PLCIOLOG_%day%_OLD
move PLCIOLOG_%day% PLCIOLOG_%day%_OLD
 
Back
Top