0

I have been trying simple FTP command in BASH script to put files to FTP server.

USERNAME="User_name_here";
PASSWORD="pass_word_here";
SERVER="ftp_url";


cd /tmp

zip -r dash.zip dash
FILE="/tmp"
echo "file zipped";

BACKUPDIR="copy_dir"

# login to remote server
ftp -n -v $SERVER <<EOF
ascii
user $USERNAME $PASSWORD
cd $BACKUPDIR
mput $FILE/dash.zip
quit
EOF
echo "done";

After executing I am receiving error 550 FileName invalid Please suggest..

Surya
  • 11
  • 1
  • 3
  • 1
    Looks like you either don't have /tmp/dash.zip on your local computer or either /tmp or ./copy_dir on the remote host, do you? By the way, switching to ascii mode to upload a binary file is a bad idea. – DYZ Mar 23 '17 at 05:50
  • I verified both location proper DIR has created. – Surya Mar 23 '17 at 06:10
  • Yes both directory is created by my account – Surya Mar 23 '17 at 06:15
  • Do you have permissions to write into /tmp on the remote host? (That's where the is being uploaded). As a matter of fact, you probably want to do `put $FILE/dash.zip dash.zip` to avoid absolute path issues. – DYZ Mar 23 '17 at 06:17
  • If I direclty loging to FTP server and then pull the files, Files are getting copied to the remote server, but when I am trying to push it through local to remote it is giving error – Surya Mar 23 '17 at 06:19

0 Answers0