Solved

Auto creating copies of a file, renaming it to current day, generating 7 of these, only keeping last most recent 7 days.

Posted on 2003-11-25
5
242 Views
Last Modified: 2010-04-11
Hi guys/gurus.

I have a file called COMMSLOG.TXT
which is found in c:\EFT.

The file grows large very quickly, so what I would like to do is:

1) Copy the file to a new file called eft_yyyymmdd.txt each day.
2) Delete the COMMSLOG.TXT after the file has been copied.
3) Keep doing the above 2 steps, but only ever keeping the last 7 days of
logs, and deleting older ones.

Create 7 days of files like this for archiving, then automatically ONLY keep
at any one time, 7 days of these files, so on the eighth day, it will delete
the oldest one.

Can someone please explain to me what the following command will do. I dont
understand the for and tokens, delims part.

for /f "tokens=2-4 delims=/ " %%a in ('DATE/T') do SET date=%%c-%%a-%%b

Any help greatly appreciated.

Simon
0
Comment
Question by:Simon336697
  • 4
5 Comments
 
LVL 35

Expert Comment

by:ShineOn
ID: 9816684
Your best tool for doing this will be WinBatch.

Go to www.wilsonwindowware.com.

You can use it in conjunction with a scheduling program.  There are many shareware schedulers out there.
0
 
LVL 35

Assisted Solution

by:ShineOn
ShineOn earned 125 total points
ID: 9816690
I, personally, did what you want to do using a combination of a scheduler, WinBatch, and PKZiP or some other ZIP-type utility.  The stuff to be archived automatically gets added to a ZIP (or whatever compressed archive format) file, using a filename generated based on date and/or sequence, all handled throught WinBatch and scheduled through a scheduling program, like Schedule Wizard.
0
 
LVL 35

Expert Comment

by:ShineOn
ID: 9816706
As far as the for statement you posted, I have no idea, not knowing what it is written in.  Is it DOS batch language or the updated Windows version of the DOS batch language, or some other batch language, or maybe even QuikBasic???  Dunno...

We  need more info on your environment and exactly how what data from where needs to be manipulated in what way to give you the result you're looking for...

Does that confuse you more or less?
0
 
LVL 18

Accepted Solution

by:
chicagoan earned 125 total points
ID: 9816751
i think the link s/b http://files.windowware.com/

0
 
LVL 35

Expert Comment

by:ShineOn
ID: 9817748
Thank you.  You are correct.  It used to be wilsonwindowware - they must've gotten a better URL in the past couple-few years... ;)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Port forwarding 14 153
Network access 4 40
Advertise subnet not directly attached 6 31
Wired Network vs Wireless 12 58
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
I had an issue with InstallShield not being able to use Computer Browser service on Windows Server 2012. Here is the solution I found.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question