CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
how to check a directory exists or not in a remote machine using telnet module

 



anraevlus18
New User

Jul 15, 2010, 7:00 AM

Post #1 of 2 (640 views)
how to check a directory exists or not in a remote machine using telnet module Can't Post

Hi this is the first time i am using telnet module. I want to login to a remote machine and do a series of steps including creating and modifying files and executing some scripts which resides in the remote machine itself. Can any one tell me how to check a directory exists or not in the remote machine using the telnet module...

my code:
========

using Net::Telnet;

$t = new Net::Telnet();
$t->open($remote_system);
$t->login($username, $passwd);

# this doesnot work.
if (-d $my_dir) { print "ready to go"; }

$t->close();

=========


FishMonger
Veteran / Moderator

Jul 15, 2010, 7:30 AM

Post #2 of 2 (635 views)
Re: [anraevlus18] how to check a directory exists or not in a remote machine using telnet module [In reply to] Can't Post

The starting point would be to read the module's documentation to find out how to execute a remote command. Then you need to determine what command you need to execute when not using Perl. In this case, I'd either use the 'file' command or 'ls -l' or the stat command and parse the results.


(This post was edited by FishMonger on Jul 15, 2010, 7:35 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives