On Mon, Aug 11, 2003 at 09:42:40AM -0400, Stephen Gilbert wrote: > > -----Original Message----- > > From: SilverFox [mailto:[EMAIL PROTECTED] > > Sent: Sunday, August 10, 2003 4:58 PM > > To: [EMAIL PROTECTED] > > Subject: Net::Telnet > > > > > > hey anyone know how to check if a file exists using the Telnet module? > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > try: > $file_exists = $t->cmd("perl -e 'print 1 if (-s \"file\")'") or warn "Unable to > execute command: $!\n"; > if ($file_exists) { > # do whatever > }
'if (-s)' will actually check that the file has non-zero size (-s returns the size; if the size if 0, it is false). If you simply want to know whether it exists, but you don't care what size it is, then use -e. --Dks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]