Synchronizing directory hierarchies via SFTP

Patrick Hess patrickhess at gmx.net
Wed Dec 9 15:54:24 UTC 2015


Michael Ross wrote:
> You can put it in a file
> 
> 	#!/usr/local/bin/lftp
> 	open sftp://user:pass@host
> 	mirror -v --reverse --dereference ...

Is there an easy way to pass parameters to that file?
I'd like to be able to pass in different source and
target directories to the mirror command.

Meanwhile, I figured out how one is supposed to use
the -c option correctly:

    lftp -c "connect sftp://$SFTP_USERNAME:$SFTP_PASSWORD@$SFTP_SERVER && \
             mirror -v --reverse --dereference --delete --overwrite \
                    --exclude-glob *.swp $LOCAL_DIR $REMOTE_DIR; \
             quit"

That's at least not as messy as the Expect script.

> That gives you about a week before the script actually exits.

The way I see it, that gives the server about a week
to finally get its stuff together.  ;-)

Patrick


More information about the freebsd-questions mailing list