[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2006-07-15
10
Medium Priority
?
185 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 200 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Simple Linear Regression
Introduction to Processes

656 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