Guest User

Untitled

a guest
Sep 20th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #!/bin/sh
  2. # @author: Alexandre Plennevaux
  3. # @description: MIRROR DISTANT FOLDER TO LOCAL FOLDER VIA FTP
  4. #
  5. # FTP LOGIN
  6. HOST='sftp://ftp.domain.com'
  7. USER='ftpusername'
  8. PASSWORD='ftppassword'
  9.  
  10. # DISTANT DIRECTORY
  11. REMOTE_DIR='/absolute/path/to/remote/directory'
  12.  
  13. #LOCAL DIRECTORY
  14. LOCAL_DIR='/absolute/path/to/local/directory'
  15.  
  16. # RUNTIME!
  17. echo
  18. echo "Starting download $REMOTE_DIR from $HOST to $LOCAL_DIR"
  19. date
  20.  
  21. lftp -u "$USER","$PASSWORD" $HOST <<EOF
  22. # the next 3 lines put you in ftpes mode. Uncomment if you are having trouble connecting.
  23. # set ftp:ssl-force true
  24. # set ftp:ssl-protect-data true
  25. # set ssl:verify-certificate no
  26. # transfer starts now...
  27. mirror -R --use-pget-n=10 $REMOTE_DIR $LOCAL_DIR;
  28. exit
  29. EOF
  30. echo
  31. echo "Transfer finished"
  32. date
Add Comment
Please, Sign In to add comment