15

So I use pelican for writing my blog and I upload the whole thing using rsync. OK.

But I use also Let's Encrypt and therefor need the repository .well-known preserved at the root of my website.

So is there a way I can say "rsync ... --do-not-delete .well-known ..."

Currently, those rep' are permission protected, but rsync doesn't like it.

Here is the current rsync command (installed by pelican itself, I did not write it) :

rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude

BTW : if you have also some suggestion to improve rsync efficiency, I take it (yes, it's off topic).

1
17

From man rsync

--delete This tells rsync to delete extraneous files from the receiving side (ones that aren’t on the sending side), but only for the directories that are being synchronized. You must have asked rsync to send the whole directory (e.g. "dir" or "dir/") without using a wildcard for the directory’s contents (e.g. "dir/*") since the wildcard is expanded by the shell and rsync thus gets a request to transfer individual files, not the files’ parent directory. Files that are excluded from the transfer are also excluded from being deleted unless you use the --delete-excluded option or mark the rules as only matching on the sending side (see the include/exclude modifiers in the FILTER RULES section).

So I think it should be

rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --delete \
$(OUTPUTDIR)/ \
$(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) \
--cvs-exclude --exclude=/.well-known

(assuming .well-known is at the root of $(SSH_TARGET_DIR)/)

8

You should use the --exclude option in order to make rsync ignore that directory. Unless you also use --delete-excluded (which you shouldn't, in this case), it will leave it alone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.