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
245 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Turn your laptop into a mobile console!

The CV211 Laptop USB Console Adapter provides a direct Laptop-to-Computer connection for fast and easy remote desktop access with no software to install.

Question has a verified solution.

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

Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

717 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