in reply to Display A File Via Attribute

I don't know how you can tell what is a "report" or what "last modified date" refers to. But you can use File::Find in Perl (sorry, not PERL) to find .shtml files that were modified in the last 30 days:

#! /usr/local/bin/perl -w eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}' if 0; #$running_under_some_shell use strict; use File::Find (); # Traverse desired filesystems File::Find::find({wanted => \&wanted}, '.'); exit; sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); return unless /^.*\.shtml\z/s && (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && (int(-M _) < 30); # now do whatever you want with the file named # by $File::Find::name # this is probably not what you want to do: print("$File::Find::name\n"); }
This, by the way, was edited from the output of find2perl:

$ find2perl . -name "*.shtml" -mtime -30
update: changed unlink to print

Replies are listed 'Best First'.
(boo)Re: Re: Display A File Via Attribute
by boo_radley (Parson) on Jun 05, 2001 at 22:29 UTC
    this is to keafb, as you've said you're very new to perl :

    DO NOT RUN THIS CODE AS IS


    See that unlink at the end? that'll delete every file it comes across that matches the regex /^.*\.shtml\z/s. Beware.
    You might want to change it to print ... or something else until you can understand what's going on.

    note to others : I know that bikeNomad warned him, but I think a larger warning couldn't hurt in this case, ok?

      Sorry. I changed it.