Created
June 15, 2012 21:27
-
-
Save ChrisBuchholz/2938782 to your computer and use it in GitHub Desktop.
script to set up dir mirroring with lftp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## http://serverfault.com/a/106365 | |
| ## | |
| ## As written by esel | |
| ## | |
| ## lftp is very good tool. | |
| ## | |
| ## I suggest you to parametrize the script, and make use of the | |
| ## | |
| ## exclude-glob | |
| ## options, that excludes filenames using the glob feature (*,? ..) of your shell: | |
| #!/bin/bash | |
| HOST="your.ftp.host.dom" | |
| USER="username" | |
| PASS="password" | |
| LCD="/path/of/your/local/dir" | |
| RCD="/path/of/your/remote/dir" | |
| lftp -c "set ftp:list-options -a; | |
| open ftp://$USER:$PASS@$HOST; | |
| lcd $LCD; | |
| cd $RCD; | |
| mirror --reverse \ | |
| --delete \ | |
| --verbose \ | |
| --exclude-glob a-dir-to-exclude/ \ | |
| --exclude-glob a-file-to-exclude \ | |
| --exclude-glob a-file-group-to-exclude* \ | |
| --exclude-glob other-files-to-esclude" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment