My script should be waiting for the incoming files and encrypts them as
soon as the transmission is completed. Using "lsof" makes a gap between
the arrival of the files and their encryption.

Is there any other way to know that a file is being FTPed, specifically?

Thanks,
Ahmed


On Sat, 24 Nov 2001, John W. Krahn wrote:

> Ahmed Moustafa Ibrahim Ahmed wrote:
> > 
> > In Perl, how can I know that a file is being opened by any other process
> > i.e. being edited or transferred (FTP)?
> > 
> > I made following function but it's very slow because of the using of "lsof":
> 
> You are also using "grep" and "wc".
> 
> > ---------------------------------------------------------------
> > sub is_open {
> >     local ($file) = @_;
> >     $flag = qx ( $settings{'lsof'} | grep $file | wc -l);
> >     $flag =~ s/^\s+//;
> >     $flag =~ s/\s+$//;
> >     if ($flag == 0) {
> >         return "";
> >     } else {
> >     return 1;
> >     }
> > }
> 
> It is kind of hard to test without the actual command line settings for
> "lsof".
> 
> 
> 
> John
> -- 
> use Perl;
> program
> fulfillment
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to