On 10/22/98 12:14 AM strider corinth wrote: >This script is supposed to delete files in a directory dropped onto it >which are more than 31 days old. It's a little messy, but it deletes >younger files as well. Anyone know what's up? This is a perl question, not a MacPerl question. The perl newsgroup is a better place to ask perl questions. When in doubt use parantheses. I don't think this is what you want: unlink $fullpath if $age > 31 || print "Couldn't unlink $fullpath: $!\n"; I think that is evaluated as: unlink $fullpath if ($age > 31 || print "Couldn't unlink $fullpath: $!\n"); How about this? #!/usr/bin/perl die "Usage: newfiles_aging.pl <directory>\n" if !$ARGV[ 0 ]; opendir( DIR, $ARGV[ 0 ] ); @dir = readdir( DIR ); close( DIR ); foreach $file( @dir ){ $fullpath = "$ARGV[0]/$file"; $age = (-M $fullpath) || die "Couldn't get age of $fullpath: $!\n"; if ($age > 31) { unlink "$fullpath" || print "Couldn't unlink $fullpath: $!\n"; } } --David ------------------------------------------------------------- Online Support Services | Phone: 603-332-9400 Cabletron Systems, Inc. | BBS: 603-335-3358 [8N1] support@ctron.com | http://www.cabletron.com ------------------------------------------------------------- ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch