1

I am trying to ftp some recording files to a remote server for backup every night. I am very confused regarding shell script.

My question / problem is : I want to move the whole folder/directory instead of file to the remote server.

Here is current script:

HOST='10.113.68.50'
USER='sms'
PASSWD='Abc123451'
LOCALPATH='kmpy/unica/Campaign/partitions/partition1/CiktiDosyalari'
FILE=*.sms
DIR='SMS/'

ftp -n $HOST <<EOF
quote USER $USER
quote PASS $PASSWD
cd $DIR
lcd $LOCALPATH
put $FILE
quit
exit;
EOF
  • 2
    If you can then use sftp or scp, you will need a ssh server on the remote machine. sftp and scp are more secure, and easier to use. – ctrl-alt-delor Aug 7 '14 at 19:35
6

you can use mput * instead of put to upload all of the files in the directory. Further you can screen files, for example: mput *.jpg will transfer all and only jpg files.

0

I would use SCP instead of FTP. SCP is more secure, and a part of SSH. As long as your public key is in the external hosts authorized_keys-file, then you can just do something like:

scp -r kmpy/unica/Campaign/partitions/partition1/CiktiDosyalar/ sms@10.113.68.50:/sms/

Some reason why you chose FTP?

  • Agreed. Unless you do not have control over the remote site and you have no option but to use ftp, then configure your systems to use scp and sftp instead. – Warwick Aug 7 '14 at 23:11
  • 1
    Yeah. He may need to upload his stuff on a server that offers FTP only? – Dakatine Nov 13 '15 at 22:49
  • I don't understand why people keep suggesting SSH when the question is FTP. There are a lot of situations when ssh is not available. – Augustin Riedinger Aug 31 '16 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.