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
240 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now