Upload sites files and folders via ftp bash - bash

I need a script to upload files of sites with directories to hosting via ftp.
I try to create a script, but it doesn't work. NO files are on the server. Can you help me, please?
My script
#!/bin/bash
HOST='ip_address'
USER='user'
PASSWD='password'
SERVER_FOLDER='/site'
cd /local_folder_with_sites_files
ftp -in <<END_SCRIPT
open $HOST
user $USER $PASSWD
cd $SERVER_FOLDER
mput -r *
close
bye
END_SCRIPT
echo "Upload complete"
exit 0
Output:
directory: not a plain file.
Permission denied.
Passive mode refused.
OS: Ubuntu 16.04 Panel: VestaCP
But when i upload files via filezilla, uploads is complete.
If anybody has a script which uploads files and folders via ftp, please, show me for example.

Related

upload files to remote host over lftp

I have this script to upload and delete files on my remote host:
#!/bin/bash
echo Starting Website upload ...
echo This may take some time depending on your internet connection ...
echo Waiting for remote connnection ...
lftp -u server121.web-hosting.com << ftpEOF
prompt
cd public_html
delete index.html
cd images
mdelete *.jpg
cd ..
lcd /Applications/PlexEmail/streamnet/
put index.html
lcd images
cd images
mput *.jpg
bye
ftpEOF
echo Website upload successfull ...
After upgrading my Mac to High Sierra 10.13, the ftp command no longer exists.
Any ideas on how to get this to work with lftp?

ksh script to send .jpg to remote server through ftp script

Hello just created a ksh script to ftp .jpg image to a remote server but the images are showing in bad qulity when I send them with the script is there a line I should fix to not alterate the image a deliver the image to the remote server like the original please help, should I add the bin line?
cp -r /path/dir/*.jpg /path/dir
cp -r /path/dir/*.JPG /path/dirREMOTE
USER='xxx'
PASSWORD=xxx'
source_dir='cd /path/images/'
target_dir='cd /images'
ftp -n xxx.xx.xxx.xx <<_FTP
quote USER $USER
quote PASS $PASSWORD
lcd /xxx/xxx/
cd /xxx
mput *.jpg
bye
_FTP
/home/test_scripts/test_script9.sh
/home/test_scripts/test_script7.sh
exit
enter code here

Download files from specific folder in AIX box

I have an AIX box. I wanted to connect to remote FTP server and download a specified folder "abc".
I have created a script; but it isn't working.
Here is my Code:
#!/bin/sh HOST='ftp.abc.xysz.net' USER='ftp' PASSWD='password' FILE='ababababababababababababab.abab';
ftp $HOST user $USER $PASSWD mget $FILE
quit END_SCRIPT
exit 0
Here is the error I receive when I execute Script..
Anyone has any idea to download the files from remote FTP server. Is there any single command available
Your script doesn't look properly formatted... it would be something like this:
#!/bin/sh
HOST='10.129.151.41'
USER='technicolor'
PASSWD='blueray'
FILE='ababababababababababababab.abab'
ftp -n <<END_SCRIPT
open $HOST
user $USER $PASSWD
get $FILE
quit
END_SCRIPT

Automating ftp downloads with shell script

I want download a bunch of .txt.gz files by ftp. I've written this shell script. How do I get all the files on the sever with out specifying each file?
Some code..
#!/bin/bash
ftp -i -n <<Here
open ftplink.com
user Username password
bin
get XXX_xxxx_mp.txt.gz
get XXX_xxxx_mp.txt.gz
close
quit
Here
Use wget instead:
wget ftp://user:pass#example.com/dir/*_mp.txt.gz

moving remote files inside ftp in shell script

I want to ftp file to my remote server and then move those files into another directory in the remote server
The ftp happens correctly but the movement is throwing an error like
550 RNFR command failed.
Can you please help?
My script is
#!/bin/sh
echo "Enter the version of the xml (eg:- v17.25)"
read version
HOST_FIRST='un01'
HOST_LAST='01'
USER='someuser'
PASSWD='somepassword'
HOST="$HOST_FIRST$FILE$HOST_LAST"
ftp -n $HOST <<-END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd /tmp
put myfile.xml
rename myfile.xml /tmp/test_ftp
quit
END_SCRIPT
exit 0
You have put myfile.xml to the tmp dir, why not just
edit
Change your script from
rename myfile.xml /tmp/test_ftp
TO
rename myfile.xml test_ftp
You have already put the file in the /tmp directory, which you have already done a cd /tmp .
That should work.
You can't specify a path in an ftp rename command and expect it to be moved as well.
And sorry, not what you want to here, but there is no move command in ftp. It is that way for security.
IHTH.

Resources