Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ftp multiple files using a shell script

Tags:

unix

ftp

I am trying to ftp multiple files from one machine to another using a shell script. Below is my script:

ftp -nv <<EOF
open home.machine.com
user remote monday
binary
mput *.txt
bye
<<EOF

Now, the problem is, it hangs in between, but when I try each and every command on the command prompt. After I execute mput *.txt, it asks for confirmation for each and every file. When I enter yes then it moves on to the next file, and asks again.

Am I missing something?

like image 209
M.J. Avatar asked Jul 14 '11 12:07

M.J.


2 Answers

I tried something like this:

prompt
mput *.txt

The prompt command closed the user interaction, and then it worked properly.

like image 128
M.J. Avatar answered Sep 21 '22 06:09

M.J.


From the manual:

-i Turns off interactive prompting during multiple file transfers.

like image 42
Blagovest Buyukliev Avatar answered Sep 18 '22 06:09

Blagovest Buyukliev