Forum Discussion
Altera_Forum
Honored Contributor
17 years agoAutomate FTP
Hello champs, I am trying to write a routine that automates FTP transfers. I was using ftpput in Busybox but it consumes way too much memory. I've seen some examples but they are in ksh...
Altera_Forum
Honored Contributor
17 years agoHi,
I tested again with the following script: <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>ftp -v -n <<EOF open $1 user anonymous passwd binary put $2 bye</div> Named it myftp and hit: ./myftp 172.16.9.92 sample_file The results: <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>jars@jars-desktop:~/test$ ./myftp 172.16.9.92 sample_file Connected to 172.16.9.92. 220- Welcome to the uClinux ftpd! 220 uClinux FTP server (GNU inetutils 1.4.1) ready. Remote system type is UNIX. Using binary mode to transfer files. 331 Guest login ok, type your name as password. 230 Guest login ok, access restrictions apply. Remote system type is UNIX. Using binary mode to transfer files. 200 Type set to I. local: sample_file remote: sample_file 200 PORT command sucessful. 150 Opening BINARY mode data connection for 'sample_file'. 226 Transfer complete. 110 bytes sent in 0.00 secs (852.6 kB/s) 221 Goodbye. jars@jars-desktop:~/test$ </div> I'm using bash as my default shell: bash --version GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu) Copyright © 2007 Free Software Foundation, Inc. echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007" Please make sure you've copied the script above without any changes. This script is very sensitive regarding misplaced space, EOF and end of line characters. Other than that, I don't know what could be going wrong... Good luck, Ricardo.