Downloading all files in a directory with ftp command

3

1

I am trying to download all of the files in a directory using the FTP command on Windows (Windows Server 2012 R2). Here is what I am running from the ftp command:

open myurl.com
myusername
mypassword

cd directoryIwantonExternalServer
lcd directoryIwantonLocalmachine
binary

mget *.*

Everything seems to work fine until the last line, when running mget *.*. This results in no output for an indefinite period. I am only trying to transfer as a test two text files.

Jake

Posted 2015-02-05T18:53:18.000

Reputation: 274

I don't think windows' ftp client is any good at all. Like it won't probably support passive mode either. If someone confirms it, the only workaround would be to use another FTP client or maybe create in the server an index file which contains the filenames to be downloaded. – LatinSuD – 2015-02-05T18:58:29.823

I'm wanting to automate downloading files in a batch script eventually across multiple computers. This seems like it could be the easiest solution, as it's the most universal (doesn't require additional software, inc. PS). – Jake – 2015-02-05T19:01:34.977

2Have you try to enter before mget the command prom? – Romeo Ninov – 2015-02-05T19:15:50.260

Pressing enter to make a blank line before running mget worked. Thanks Romeo! Feel free to make it an answer and I will accept it. No clue why that worked... – Jake – 2015-02-05T20:06:49.890

@RomeoNinov 's answer works because you are essentially setting variables. Things like your user name, password, the paths to the servers -- those need to be set before calling the mget .. Otherwise, you get the result you are getting. Think of it like a "GO" is SQL Server. Some stuff needs to execute before the other commands will function. – Kevin R. – 2015-02-12T23:51:16.843

Answers

0

To get indications of the process of download from ftp server you can enter command hash after entering username and password. You can in general enter the command anywhere before sending command mget

To avoid interactive questions about downloading next file (based on wildcard) you can use command prompt. This command act as switch, first execution turn it off, next turn it on and so on

Romeo Ninov

Posted 2015-02-05T18:53:18.000

Reputation: 2 062

1I'll be nice and not downvote you, but that doesn't seem right at all. use "prompt off" to turn off interactivity. Use "hash" to get the progress indicator like what you're referring to. – TOOGAM – 2015-02-13T06:48:28.093

You are right, will correct my answer. And to clarify prompt command is a switch, first execution turn it off, next turn it on – Romeo Ninov – 2015-02-13T06:49:23.743