Is there any way that I can do this as a vbs script?
Thanks!
Main Topics
Browse All TopicsI am running Windows server 2000. I need to write a script that will go out to various specified folders and delete vertain types of files (such as .log or .txt files) that are over 60 days old. This is basically a house cleaning script that i will automate in windows scheduler. Can someone tell me the syntax of the script? I have tried everything i know, and no success.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
If batch is okay, you can use delold.exe (http://www.savilltech.com
An example of the proper syntax is on the site under the link "Using from the command line".
So create a script "HouseCleaning.cmd" or whatever.cmd, with something like
@echo off
delold /q /-c /n:60 /s /d C:\Folder1\*.log
delold /q /-c /n:60 /s /d C:\Folder2\*.txt
Look for RoboDel.vbs download at:
http://www.howtofixyourstu
You have permission to modify it at will.
fs
Business Accounts
Answer for Membership
by: MidnightOnePosted on 2007-05-03 at 16:33:10ID: 19027844
In perl, I cobbled together this one and used to good effect. A copy of Perl2Exe (eval version) can change it to an executable.
n,$year,$w day,$yday, $isdst) = localtime; )+$yday)*8 6400;
,9];
use File::Copy;
$dirname = "E:/Archive_Logs";
$newdir = "NUL";
($sec,$min,$hour,$mday,$mo
$today = ((($year+1900-1970)*365.25
$dayTimeInSeconds=86400;
$dayOffset=14;
opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
while (defined($file = readdir(DIR))) {
($READTIME, $WRITETIME) = (stat("$dirname/$file"))[8
if (($today - $WRITETIME) > ($dayTimeInSeconds * $dayOffset)) { move("$dirname/$file", "$newdir");}
}
closedir(DIR);