Solved

Using rsh and ftp in VB

Posted on 2004-04-14
9
1,140 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
  • 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
 
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now