?
Solved

Using rsh and ftp in VB

Posted on 2004-04-14
9
Medium Priority
?
1,175 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 1000 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
Technology Partners: 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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month12 days, 16 hours left to enroll

777 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