Hi
Do you know what your code does?
Here you use File::find to go throgh a directory-structure - and call the function oldest on each file found.find(\&oldest, @ARGV);
In the function oldest you do some check on the file. As you see, the name of the file is passed to the function as $File::Find::name. (also in $_ ... but lets ignore that for now)sub oldest { return if defined $age && $age < (stat($_))[9]; $age = (stat($_))[9]; $name = $File::Find::name; }
So all you need to do is to replace the code inside the function oldest by some code that prints the filename instaed. I'm sure you can do this without any further hint ... :-)
Rata
update reading your question again, I am wondering if you want to find the oldest file in each subdirectory. For that, I would propose the following approach: replace your scalar variables $age and $name by a hashes. And use the directory-name as the hash-key. You will find the directory-name in $File::Find::dir.
In reply to Re: Listing old files
by Ratazong
in thread Listing old files
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |