perldirectoryrsh

How can I connect to a remote machine and list all files in a directory?


I am on a Unix machine, and I need to remotely connect, via rsh, to a Windows machine and list all the files in a particular directory.

Most of the code I've read is really confusing. Are there any short examples how to do this?


Solution

  • rsh $machine -l $user "dir $directory" 
    

    should work fine.

    try it like this:

    my @files = qx(rsh $machine -l $user "dir $directory");
    

    qx is a system call that returns its results as an array, one entry per line.

    Just out of curiosity, can you link to a confusing example?