Knowledgebase:
RES 3700 | Rotate log Backup
Posted by Rafeeq Mylappuram on 17 October 2018 09:39 AM

The site wants to move the 3700d.log from the \etc directory to the \archives\hold directory so that they can zip it and store it for future reference if the need arises

SOLUTION

In a batch file (attached) , insert the following lines:

FOR /L %%1 in (0,1,6) DO IF EXIST c:\micros\res\pos\etc\3700d.log.%%1 copy c:\micros\res\pos\etc\3700d.log.%%1  c:\micros\res\pos\ARCHIVES\HOLD
FOR /L %%1 in (0,1,6) DO IF EXIST c:\micros\res\pos\etc\3700d.log.%%1 del c:\micros\res\pos\etc\3700d.log.%%1

%%1 is a variable that will cause the do if exist command step to repeat 7 times, starting with 0, incrementing by 1, stopping with 6. So, each of the two lines above will run 7 times, the first line will run 7 times, then the second line will run 7 times, copying the 3700d.log.x files from the \etc directory to the \archives\hold then deleting the 3700d.log.x file from the \etc directory.

The path can be changed if necessary, and any other command that will execute in a batch file can be substituted for the copy and delete commands above.

Cheers!
Rafeeq.



Attachments 
 
 Run.bat (0.25 KB)
(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).