Solved

I need to create a small script "Batch" to run in Win2000 server

Posted on 2006-07-15
10
179 Views
Last Modified: 2010-04-17
Hi to all,

I need to create a small script "Batch" that should delete a file automatic, Thiese file area generated every day this the example of name of file :

error_log.1152921600    
access_log.1152964800
--------------------
error_log.1152921245
access_log.115292462

The number of the end of log always change its showing random, so ineed only to keeb for today and yesterday and before yesterday as backup example again today is 16-July-06 i need only to keeb files for 15 + 14 of july-06 and the other day should dele it auto ..

Note: in one day could the more that 4 files generate in the same name but different number.

Its clear ?

Thanks,
Nemcert
0
Comment
Question by:NemCert
[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
  • 3
10 Comments
 
LVL 1

Author Comment

by:NemCert
ID: 17116622
Its difficalt ?
0
 
LVL 2

Expert Comment

by:codoherty
ID: 17120964
If you don't mid spending a little, I use a scripting too called VIsualBuild from www.Kinook.com that will do just about anything, really well worth the money. Just a thought!
0
 
LVL 16

Accepted Solution

by:
JohnBPrice earned 50 total points
ID: 17123054
Robocopy is a free tool in the windows resource toolkit which will do the trick for you

This will delete (move to recycle bin) any file in C:\test that is more than 3 days old
robocopy C:\Test C:\Recycled /MinAge:3 /MOV
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:NemCert
ID: 17136515
Hello JohnBPrice,


I will try the tools and will c .

Thanks,
Nemcert
0
 
LVL 1

Author Comment

by:NemCert
ID: 17136588
Hello JohnBPrice,

again how to add this script the scheduall ???

should i create new file .bat then add the line there and scheduall this every day or what ?

Thanks,
Nemcert
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 17137812
Since it is only one command, you can put the robocopy command itself into the scheduled task (but you could put it in a bat if you like).  Remember to think about permissions, you might want to set an account/password for the scheduled task.
0
 
LVL 1

Author Comment

by:NemCert
ID: 17162421
About a permission noop coz am using the administrator user, I create a new file .bat and i was added the command line there but let me know the time in schedul should i slesct every day ? 0r run one times or what ?

I need the time and the date, What should i but in the scheduall ???

and there is one mistake in your command Recycler not Recycled  :)

robocopy f:\testlog C:\Recycler /MinAge:3 /MOV
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 17266308
Since you say the file is generated every day, I would schedule it every day.  The GUI for scheduled tasks in the control panel is simple enough to figure out.

>>and there is one mistake in your command Recycler not Recycled  :)
oops
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about a problem I had getting the GPS LocationListener working.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

737 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