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.

Something like this should work:

1) Use opendir/readdir to get the files or use a glob.
2) As you iterate over the files stat each one and get the mtime.
3) If the mtime is > than the saved mtime (init to 0), save it and the file name.
   If not, ignore it.
4) When done iterating the files, you should have saved the largest mtime and 
   corresponding filename.
   Now copy to another vrbl and remove the numbers using an RE (eg: s/\d+//; or some 
such).
5) Use File::Copy to copy the orig file to the new name in other dir.

Many ways to do it, make an effort and get back if you have trouble.
-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles   http://www.wgn.net/~dbe/
  / ) /--<  o // //      Mailto:[EMAIL PROTECTED]   http://dbecoll.webjump.com/
-/-' /___/_<_</_</_    http://www.freeyellow.com/members/dbecoll/

---
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]

Reply via email to