Lftp - delete source files only on remote


i have a homepage which uses a cms called TYPO3 and this takes several directories who are not in git. So only “my work” is versioned.

I want use lftp for deployment:

  • lftp -e “set ssl:verify-certificate $VERIFY_CERTIFICATE; open $SFTP_HOST; user $SFTP_USERNAME $SFTP_PASSWORD; mirror -X .* -X .*/ --reverse --parallel=10 --verbose --delete $DIR_STAGING_SOURCE $DIR_STAGING_DESTINATION; bye”

I more or less understand what it does - so “–delete” deletes all files and directories who are not versioned. Even those from the cms. Is there a way to delete only files from the “source” and keep the other? I have tried to exclude the directories from the cms but that are a lot (approx 15).

Thank you


I do not understand the source and destination directory tree, can you please share them and mark the ones which are synced?

I’m also wondering about lftp here, this seems to invoke sftp which in turn is SSH again. For that, one could mirror with rsync … or is lftp running as a change detection and then mirror tool? Never used that.