daniel508 :
Hi guys. there's a folder that users scan things into. however this folder needs to be cleaned up on a regular basis. to do this, I have created a .bat file that will clear up all of the documents in that folder. there is also an auto answer of yes so that when it prompts, it automatically replies yes. however, I'd like this to delete items say 2 weeks old and older. is there a way to do this?
Thanks
you could use a perl script change DELOLD to how many days old from today say, 120 days old, delete it, 14 days (2 weeks) delete it.
[cpp]
#!perl -w
use strict;
usage() if (! @ARGV || $ARGV[0] =~ /\D/);
my $age = $ARGV[0];
my $dir = $ARGV[1] || '.';
while (<$dir/*>) { print 'unlink $_' if -M $_ > $age; }
sub usage {
print <<'EOF';
USAGE:
DELOLD 14 [c:\yourdirhere]
[/cpp]
so just save this code into a notepad, (remove the 1. 2. 3. from each line) then save as say.. well call it, cleanup.pl .. now download and install perl
http://www.activestate.com/activeperl/downloads
put cleanup.pl in a scheduled task to run every so often or put it in windows startup so it runs each time the computer boots? what ever you prefer