http://danconia.org
Manav Mathur wrote:
use strict ; use warnings ; use File::find ; my %hash ; my %by_value ; find(sub{$hash{$_}=(stat $_)[9]},'/path/to/Udb/Backups') ; while (($key, $value) = each %hash) { push @{$by_value{$value}}, $key; } my @[EMAIL PROTECTED] {$a <=> $b} keys %by_value ; local $"="\n" ; print "@array[0..2]" ;
-----Original Message----- From: Bret Goodfellow [mailto:[EMAIL PROTECTED] Sent: Thursday, February 24, 2005 8:02 PM To: beginners@perl.org Subject: Listing a Windows file, getting creation date
Hi all,
I am very new to Perl. I have had assembler and Rexx experience on a
mainframe. I would like to be able to use Perl to list a directory, get
the propeties of the files (eg. date created), and keep the newest 3.
The reason I want to do this is because I am running a UDB system that
creates weekly backups. The backups never get deleted unless I do that
by hand. I would like to keep the 3 newest UDB backups. Any help, in
any direction, would be greatly appreciated. Once I get started on
this, I think perl will make more sense to me.
The directory structure is:
UDB
Backups
Folder1
udbbck01.bak
Folder2
udbbck02.bak
Folder3
udbbck03.bak
|
|
|
Folder(n-1)
udbbck(n-1).bak
Folder(n)
udbbck(n).bak
Bret Goodfellow
Questar Gas,
S.L.C., UT
********************************************************* Disclaimer:
The contents of this E-mail (including the contents of the enclosure(s) or attachment(s) if any) are privileged and confidential material of MBT and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee(s). In case you are not the desired addressee, you should delete this message and/or re-direct it to the sender. The views expressed in this E-mail message (including the enclosure(s) or attachment(s) if any) are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of MBT.
This e-mail message including attachment/(s), if any, is believed to be free of any virus. However, it is the responsibility of the recipient to ensure that it is virus free and MBT is not responsible for any loss or damage arising in any way from its use
*********************************************************
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>