Mike Reilley wrote:
>
> HI ALL,
>
> I have a file like
> www.txt
> There may be multiple copies of the file in the same directory
> www.txt
> www1.txt
> www5.txt
> I need to pick out the latest file by date and time drop the numeric
> suffix and copy the file to another directory.
> There is no relationship between the numeric suffix and the date &
> time. In the above it might be that www1.txt is the latest.
> I would appreciate any direction that the PERL EXPERTS would care
> To discuss.
> TIA
opendir LD,".\";
@files = readdir LD;
closedir LD;
$y = 0;
foreach $f (@files) {
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
= stat($f);
if($mtime > $y && -f $f) {
$new_file = $f;
$y = $mtime
}
}
print("$new_file\n");
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]