in reply to My filtered list is not being returned for cp

lomSpace, here's a cleaner version of your approach:

use strict; use warnings; use File::stat; use File::Find; Use File::Copy; use Time::localtime; find sub { if (/^\d+\D\d_(?:LacZ|pgK|SD|SU)/ && -M > 1) { print "$_\n", "ctime: " . ctime(stat($_)->ctime), "\n", "mtime: " . ctime(stat($_)->mtime), "\n"; # copy("$_","$seqdir"); # copy file to new directory } }, $root;

Update: I meant to add warnings, which caught an error in your original post...

Replies are listed 'Best First'.
Re^2: Trouble filtering files based on date
by lomSpace (Scribe) on Jan 30, 2009 at 21:32 UTC

    Hi!
    All of the files are being cp. I only need the
    most recent files. When I use

    if (/^\d+\D\d_(?:LacZ|pgK|SD|SU)/ && -M < 1)

    I get the error message:
    Warning: Use of "-M" without parentheses is ambiguous at find.pl line 23.
Re^2: Trouble filtering files based on date
by lomSpace (Scribe) on Jan 30, 2009 at 18:26 UTC
    Thanks, It's slick!