A liitle batch file

PLucas

Member
Join Date
Apr 2002
Location
Gillingham Kent
Posts
1,742
I know that this is not really a PLC question, but it is slightly related.

At the moment we regularly back up our PLC programs once a month, we do this by remotely controlling the PC connected up to each PLC and downloading the PLC program onto the local PC hard drive. The file on this hard drive is than copied via the PC network to the hard drive on the PC in my office.

I have written a little batch file that will do the copying for me, it runs once a month (via Windoze task scheduler) and places the program files (from the remote PLC) into a set folder on my hard drive. for example: - the PLC program from Rail Mounted Gantry crane 5 is copied to a folder named R05, RMG 10's program is copied to a folder called R10 etc. This works fine, except that on occasions we have had to find and use an older copy of a program because of corruption when the file is initially backed up to the local PC hard drive and the method I have just described over-writes the previous back up, so at times we have ended up with a corrupted file as the only back up.

What I am after is some pointers into writing an application that will do the above, but I would like it to create a folder named after the date the file was copied and place it in the original folder. So for example, RMG 10's program is copied on 10th March 03, so I would like the program files placed in a folder called 10March03 which is placed in the folder called R10.

All help, advise and assistance will be gratefully received.

Paul
 
PLucas,

Sorry I don't have a solution to create folders remotely.

But, what is the purpose of backing up of the PLC program every month, when the changes will be only in the data files. If it is the data you are interested means, you can publish it into a spreadsheet and automate the saving in different names based of time/date etc, thus you don't need to create folders.

What I thought was if I have one backup of a good working program (maybe two in case one media was damaged), it can be reused in case of program lost or errors.

beerchug
 
Paul,

Is this on your Series Six systems or something newer? I'm assuming that since you refer to a batch file you're talking about DOS and Logicmaster 6. Could you rename your existing files prior to doing the upload from the PLC? There are only three critical files in a LM6 program, XXX.lad, XXX.nam, and XXX.exp.

Once you've got them renamed, you could run an executable created with Visual Basic to move the renamed files to an archive. VB gives you a lot more freedom of expression than a DOS batch file.
 
Thanks for the replies

I will answer Steves reply first.

Yes you are correct in assuming that it is our series 6 systems that we are backing up, I wrote the batch file in DOS because that is the only way that I know, I do not know any other programming languages for the PC. I do rename them manually at the moment on my PC after they have been copied, but as I am only human sometimes I forget to do it or I am too busy and occasionally I have been known to be to ill to go to work (that is rarely though). Your suggestion of using VB seems to be the way to go, I will look into it.

Chavak,

The purpose of backing up our programs every month is due to the fact that modifications to the program are made on a regular basis, firstly I re-calibrate each crane every month, so the scaling factors and sometimes the offsets for each movement (long travel, cross travel and hoist) are changed on a regular basis. We are continually looking to improve the reliability and performance of the cranes thus the programs are changed in an attempt to give us that improvment. If we have a crane that has an intermittant fault, as we do not have the staff number to sit and monitor the crane we would write some extra logic to do the monitoring for us, all these factors need to be taken into account which means we do need up to date back ups.

It looks like I will have to learn some VB then, I will start searching today but if anybody knows any good sources on the net then I would be grateful.

Paul
 
I do this in reverse.
Office PC Has dated folders named as YYYYMMDD. A Network server also has the same folders. Each dated folder contains every program in use in your case RM01 to RM10.
These are for program history.
I then send a copy to a working folder on the remote PCs. Only one version is keep on each remote PC. Less confusing for part timers
I run the batch when ever mod is done to any program. This is part of our mods proceedure.
I try to do all work from Office PC.
Each remote PC has RSLogix installed for troubleshooting.(looking to the office PC for offline documentation).
This gives me multiple backup sites in the event of failure.
To do the date thing in a batch is different for each OS. Mine is for NT4. I stole it from a dos web site. My file is rough but could be dressed up by smarter people.
 
DOS batch input parameters

Maybe I'm missing something...

Could this problem be solved by using input parameters
in the DOS batch file?

I remember using %1, %2, %3 as input parameters, in this way:

Batch file called RUNONCE.bat

if you type

RUNONCE ABC 123 xyz.ext

then,

inside the RUNONCE.bat file, you can do this:

cd\
mkdir %1
rd %2
copy c:\%3 prn

this would make a directory called ABC,
delete a directory called 123
and print a file called xyz.ext
 
JD

Thanks for your suggestion, that is the sort of thing that I am after, but for a couple of points.

1. I do not want to delete the previous back up copy, so I would just do away with the RD command.

2. I assume that by using this method I would have to update (ie manually change the directory names) the batch file everytime it is run. Is this correct?

I was looking for something that would do all that for me, if that is possible, because as I previously stated I am only human and my memory is not quite what it was...

Keep up with the suggestions though, if I dont have to learn a bit of VB for this then so much the better.

Paul
 

Similar Topics

Hi Everyone, Thought I had it figured out but I came to the conclusion it would not work. Here is what I'm working with... 1769-L30ER Flow Meter...
Replies
24
Views
693
Does anyone have expereince creating a custom API to build a campaign management system for FactoryTalk Batch? Stuck between using a REST API or...
Replies
0
Views
463
https://literature.rockwellautomation.com/idc/groups/literature/documents/qs/iasimp-qs042_-en-p.pdf The video links in this pdf are not working...
Replies
1
Views
1,124
Can someone shed some light on what the connector is that allows Batch to connect to Historian and create historical trends based on batch...
Replies
0
Views
692
Complete novice trying to integrate an industrial fluid filling process into MES using an anybus communicator Hardware: Anybus Communicator...
Replies
3
Views
1,583
Back
Top Bottom