RE: Compare file modification time

2005-02-14 Thread Babale Fongo
PROTECTED] ||Sent: Saturday, February 12, 2005 5:19 PM ||To: [EMAIL PROTECTED] ||Cc: beginners@perl.org ||Subject: Re: Compare file modification time || ||[EMAIL PROTECTED] wrote: || How do I best compare mtime of several files. I have a script for making || daily backups into a given directory

Re: Compare file modification time

2005-02-14 Thread Wiggins d'Anconia
Please bottom post Babale Fongo wrote: It was just an attempt to see how someone else may tackle this issue. I thought of sorting, but I wasn't sure it will do exactly what I expect. Here is what I've have so far: my $dir = /mydir; opendir(DH, $dir) || die Failed to open $dir: $!\n; my

Re: Compare file modification time

2005-02-14 Thread John W. Krahn
Babale Fongo wrote: It was just an attempt to see how someone else may tackle this issue. I thought of sorting, but I wasn't sure it will do exactly what I expect. Here is what I've have so far: my $dir = /mydir; opendir(DH, $dir) || die Failed to open $dir: $!\n; my $counter = 0; while

Re: compare file modification time

2005-02-14 Thread John W. Krahn
[EMAIL PROTECTED] wrote: #!/usr/bin/perl -w use strict; #use diagnostics; my $dir = testdir; opendir (DH, $dir) || die Could not open $dir: $!\n; my @files; my $keep = 7; while (defined(my $file = readdir(DH))){ next if $file =~ /^\.+$/; push (@files, $file); } # Skip the rest if number of

Re: Compare file modification time

2005-02-12 Thread Wiggins d'Anconia
[EMAIL PROTECTED] wrote: How do I best compare mtime of several files. I have a script for making daily backups into a given directory. Now I want to modify it to delete old backups if the total exceed cetain number. The idea was to compare the mtime of all file to figure out old files to