Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Ftp Prompt Question

Posted on 2004-04-20
9
Medium Priority
?
2,587 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 200 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 48

Accepted Solution

by:
Tintin earned 200 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 400 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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 response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

597 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