How can I connect to a remote machine and list all files in a directory?
I am on a Unix m开发者_运维问答achine, 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?
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?
精彩评论