ftp mput without confirmation in shell script

Hi,

I need to upload the output of my MapReduce to my web server using FTP. Here is how I uploaded all the files of output folder to ftp with a single script

 

NOW=$(date +"%Y-%m-%d")
HTML_OUTPUT_FOLDER=output/output_html/$NOW
mkdir $HTML_OUTPUT_FOLDER

HOST='myftpsite'
USER='myftpuser'
PASSWD='myftppassword'
REMOTE_FOLDER=public_html/nandu/$NOW


cd $HTML_OUTPUT_FOLDER
echo Current directory
pwd
echo Files would be uploaded to $REMOTE_FOLDER

ftp -i -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
mkdir $REMOTE_FOLDER
cd $REMOTE_FOLDER
mput *.*
quit
END_SCRIPT

exit 0
cd $HOME/feed

note – ftp -n will mput the files without prompting.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top