Hi David,

This looks fantastic to start with,  I apreciate your help. Let me give it a
shot and see what happens.

-Thanks

David wrote:

> the following should get you started:
>
> #!/usr/bin/perl;
>
> use Time::Local;
>
> @servers = ('server1','server2','server3');
> @users = ('user1','user2','user3');
> @files = ('file1','file2','file3');
>
> foreach my $file (@files){
>     #-- if the file is older than 7 days
>     if(get_diff($file) > 7){
>         #-- to each server
>         foreach my $server (@servers){
>                 #-- to each user
>                 foreach my $user (@users){
>                      #-- you will replace the following
>                      #-- with your actual mailer. i can't help
>                      #-- you on that :-)
>                      print "HI $server: $user: $file is older than 7
> days\n";
>                 }
>         }
>     }
> }
>
> sub get_diff(){
>         #-- today
>         my($day,$month,$year) = (localtime)[3..5];
>         #-- file's last modified date in seconds
>         my $lm = (stat(shift))[9];
>         #-- turn day/month/year into seconds
>         my $sd = timelocal(undef,undef,undef,$day,$month,$year);
>         #-- turn seconds into days
>         return int(abs($lm-$sd) / (24*60*60));
> }
>
> david
>
> Ashutosh Jog wrote:
>
> > Hi all,
> >
> > I am trying to write a script which checks a dir for a file and then
> > compares the number of days old the file is. Comparing this the mail
> > should go to a user to whom the file (in the dir) belongs.
> > Likewise there will be 'n' number of directories for 'n' number of users
> > on this Server. The server is a Win platform server.
> >
> > I am a complete newbie to Perl and am not sure what the best way to go
> > about this script would be. Any help in these quarters would be
> > appreciated.
> >
> > Thanks.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to