Solved

Ftp Prompt Question

Posted on 2004-04-20
9
2,574 Views
Last Modified: 2013-12-26
Hi,

I am using mget to download all the files within a directory from an ftp server to my local machine.

I am using something like this:

cd <remote directory>
lcd <local directory>
prompt
mget *

however, how can I make sure that interactive mode is OFF?  I know that by using prompt, the mode will toggle between On and OFF.

A couple of times I ran into the problem that interactive mode was already off and I turned it on with my program.

Is there a way to check this?

Thanks
0
Comment
Question by:aarons34
[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
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 3

Expert Comment

by:dtkerns
ID: 10872869
it's some what dependant on your version of ftp ... mine tells me:

ftp> prompt
Interactive mode off.
ftp> prompt
Interactive mode on.
ftp>

if you're scripting this (say via expect) you can make it smart enough to issue prompt until it's in the 'right' state

0
 
LVL 3

Assisted Solution

by:dtkerns
dtkerns earned 50 total points
ID: 10872886
my version also has a -i option to turn it off

ftp -i host
0
 
LVL 1

Author Comment

by:aarons34
ID: 10873938
Well, I'm making a DOS shell called from a VB6 routine in Access.

The problem that I have is since the ftp has to be hidden to the Access user, if I by mistake turn interactive mode on and do the mget, then the program will freeze waiting for an answer which will never get there because it's hidden.

Eventually I'll move this routine to a Visual Studio one but in the mean time it's imperative that it's always off.

What exactly does the '-i' part of the command do?

Thanks
0
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!

 
LVL 48

Accepted Solution

by:
Tintin earned 50 total points
ID: 10874580
-i turns off interactive mode.
0
 
LVL 12

Expert Comment

by:stefan73
ID: 10876226
Hi aarons34,
> DOS shell called from a VB6 routine
There should be a better way to do this via some API call.

Cheers,
Stefan
0
 
LVL 9

Expert Comment

by:HamdyHassan
ID: 10878385
Can you post source of " DOS shell" ?
and we try to make it work.

otherwise, you can use VBScript .vbs to do FTP and forget about .bat
0
 
LVL 1

Author Comment

by:aarons34
ID: 10880521
stefan73:

I agree there should be a better way, and I would love to have it. I actually have another question open for that. However, the program is already working fine and I just need to make that validation. Therefore, It will take me less time to just adapt that part than to write a whole new module on VB6. I want to move in that direction, and if someone can provide me on how to do it awesome! especially because I hate having the password in a file that can be easily read with Notepad!

HamdyHassan:

Next is the code I am currently using in VB to create the .bat files:

For download, I use three:

'--------This one will delete all the used file when the program is over----------------
    Open "c:\delefiles.bat" For Output As #1
        Print #1, "del c:\download"
        Print #1, "del c:\dwnld.bat"
        Print #1, "del c:\delefiles.bat"
    Close #1

'------------- This is the one containing the tasks that I want to perform-------------
    Open "c:\download" For Output As #1
        Print #1, "myusername"
        Print #1, "mypassword"
        Print #1, "prompt"
        Print #1, "cd directory1"
        Print #1, "lcd c:\localdirectory1"
        Print #1, "mget *"
        Print #1, "cd .."
        Print #1, "cd directory2"
        Print #1, "lcd c:\localdirectory2"
        Print #1, "mget *"
        Print #1, "cd .."
        Print #1, "cd directory3"
        Print #1, "lcd c:\localdirectory3"
        Print #1, "mget *"                                 '------- I repeat through 15 directories
        Print #1, "Disconnect"                  
        Print #1, "bye"
    Close #1

'------------This is the DOS program that will call the ftp-----------------------
    Open "c:\dwnld.bat" For Output As #1
        Print #1, "ftp -i -s:c:\download 1.2.3.4"          '--------I included dtkerns suggestion now but I still don;t have a way to
                                                                          '--------know if it was already OFF to avoid the program to turn it ON
        Print #1, "EXIT"
    Close #1

'-------------After I created those files, I use:
Call Shell("c:\dwnld.bat", vbHide)
Call Shell("c:\delefiles.bat", vbHide)

The files are not big (between 1k and 3k) so it doesn't take long. I just want to make sure that the prompt is always OFF

Something like:

If 'prompt' = ON THEN
       turn prompt OFF
Else
       'leave it OFF
End if

I am going to make two things with this question:

1. I want to ask the moderator for advise because I think the experts are right and it's better to do it in vb. That way I don't have to call the shells and I can hide the password in an .exe or the vb code as part of the solution. will this be considered a new question?

Therefore, I would like to know if I have to post it as a different question or I can split the points at the end in this one?

2. I am willing to raise the points to 500 if I can get that code to be within the VB code of my solution and forgetting about the .bat files. If that is not posible but I get the same effect on my current DOS shells I'll go with 200.

Thanks!
0
 
LVL 9

Assisted Solution

by:HamdyHassan
HamdyHassan earned 100 total points
ID: 10891687
-i
Disables interactive prompting during multiple file transfers.

Please go ahead with "-i" , It's not on-off issue as you think

If it's off , it will be off
If if's on, it will be off
It's "DISABLE" interactive prompting

Print #1, "ftp -i -s:c:\download 1.2.3.4"
0
 
LVL 24

Expert Comment

by:fridom
ID: 10896144
You do not have to use vb for that just use the right tool for the job. For you either curl http://curl.haxx.se or wget may be the right choice.

That are command line tools with which you can automate download tasks.
e.g for getting all files in a directory you can use wget this way:

wget "ftp://server_I_want_to_get_my_stuff_from/path/*"

Adding passwords to is is a matter of providing some options.


Regards
Friedrich

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 84
notReplace  challenge 53 151
sum13 challenge 24 134
How to convert MFC::CString to UTF8 wchar_t* 10 386
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 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