I'm using LFTP in a script called by PHP, to sync files between my local drive and my webspace using reverse mirror. This works:
lftp sftp://user:pass@host-p 22 -e 'set sftp:connect-program "ssh -o StrictHostKeyChecking=no -a -x -i /home/.ssh/yourkey.key";
mirror -eRv --delete /media/sparky/Artwork/Web/Sites/space-art.co.uk/ /spaceart; quit;'
But when I try to exclude certain folders/files, it systematically deletes all my files on the remote server. I used this:
lftp sftp://user:pass@host-p 22 -e 'set sftp:connect-program "ssh -o StrictHostKeyChecking=no -a -x -i /home/.ssh/yourkey.key";
mirror -eRv
--exclude .vscode/
--exclude *.clpprj
--exclude *.scprj
--exclude database/scripts/
--delete /media/sparky/Artwork/Web/Sites/space-art.co.uk/ /spaceart; quit;'
I call the above script using this:
$output = shell_exec("/media/sparky/Artwork/Web/Sites/markgarlick.com/database/scripts/.sync-spaceart.sh") or die ("Error syncing to space-art.co.uk");
What am I doing wrong?
Thanks.