Shell script to copy all files recursively and upload them to remote FTP server

Posted on in Categories Backup, Ftp last updated April 9, 2008

18 comment

  1. Hi All,
    We are using commaand as,

    /usr/bin/ncftpput -u $username -p $passwd

    But it does not overwrite file on remote server if it already present.
    Any suggestions???

  2. Is there a way to skip sir, it’s very important as I’m doing massive amount of files, and our destination server’s connection isn’t reliable. Cheers

  3. hi , I have shell script to sftp the files from one server to other server. When executed manually it works fine but when scheduled the script using crontab it fails.
    Below is the piece of code. Please help me in solving this issue. Thanks in advance.

  4. Hello,
    I hade to delete “$myf” in the line below:
    CMD=”$FTP -m -R -f $AUTHFILE $myf $remotedir $localdir”

    Then it all went well.

    Thank you for an good and simple script!
    /Pelle

  5. Can we add this script to cron and have it auto backup? I am looking to back up entire dir every week, like at 3am, when there is the least amount of traffic, but I don’t want to have to be around for this to happen.

  6. I am taking server name from a file and everything working fine buy my problem is if a server in the list is not connecting it is not going to next available server. How to get the ftp status in the script if ftp is not connecting how to skip to next available server .

  7. If using the AUTHFILE option, don’t forget to set the following variables in this script

    myf=”my-ftp-server.com”
    remotedir=”/my/remote/dir”
    localdir=”/my/local/dir”

    And yes, you will need ncftp installed, if it is not already
    For OS X with mac ports,
    sudo port install ncftp

Leave a Comment