Solved

Using rsh and ftp in VB

Posted on 2004-04-14
9
1,162 Views
Last Modified: 2007-12-19
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
0
Comment
Question by:AugustineWan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 19

Accepted Solution

by:
BrianGEFF719 earned 250 total points
ID: 10825607
you can do

dim remote_host,user_name,buffer
dim final

remote_host = "site.com"
user_name = "bill"
Shell "rsh " & remote_host & " -l " & user_name & " ls > out.txt"
open "out.txt" for input as #1
do while eof(1) = false
line input #1, buffer
final = final & buffer
loop
close #1

msgbox "return: " & vbcrlf & final

0
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10825617
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
0
 

Author Comment

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

Thanks
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10826232
Whatever the output from the RSH command is, it will be stored in out.txt


-Brian
0
 

Author Comment

by:AugustineWan
ID: 10826584
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
0
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10826784
So your program can process the output from the RSH.

-brian
0
 

Author Comment

by:AugustineWan
ID: 10826892
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

0
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10827134
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
0
 

Author Comment

by:AugustineWan
ID: 10827434
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?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question