Link to home
Start Free TrialLog in
Avatar of AugustineWan
AugustineWan

asked on

Using rsh and ftp in VB

Hi:
My question has 2 parts.

A) How can I use the unix command "rsh" in my stand alone VBA to list out files in our unix box?  For example, the "rsh" I intend to use is:  "rsh  remote_host_name  -l  user_name  ls"

B) After the files are listed out, I want to use ftp or a ftp script to download the files into an Access table in my Local C:\ drive.  How can I do so?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of BrianGEFF719
BrianGEFF719
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
now, as far as ftping, thats a completely different question.


You can either use the FTP cmd, by dynamically generating a command list then passing the command list to FTP. Or you can hard code the ftp (takes a lot of time).


-Brian
Avatar of AugustineWan
AugustineWan

ASKER

Do I have to create out.txt first ? What is the purpose of "out.txt" and where should this file be located?

Thanks
Whatever the output from the RSH command is, it will be stored in out.txt


-Brian
Thanks replying.

What is the purpose of having to open the "out.txt" file? ....

open "out.txt" for input as #1
do while eof(1) = false
line input #1, buffer
final = final & buffer
loop
close #1
So your program can process the output from the RSH.

-brian
I see.  For the FTP part, do you mind if you could further expand when you said:

You can either use the FTP cmd, by dynamically generating a command list then passing the command list to FTP?


Thanks

Basically, what you can do with the FTP Command is this:

ftp -s:cmds.txt


where cmds.txt is a text file containing a list of commands for the FTP program.

cmds.txt
----------
open site.com
user username
pass password
get file.exe c:\file.exe
Hi again.

I am writing the ftp commands into a text file "cmds.txt" and it contains:

open aixtest
user johndoe
pass 1234

But when I ran "ftp -s:cmds.txt", it does not recognize the password part.  It says:
"Password required for user johndoe."
"Login inccorrect"

Is there something wrong with the syntax?