How to tell rsync not to delete some folders at destination?

Multi tool use
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).
rsync
add a comment |
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).
rsync
add a comment |
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).
rsync
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).
rsync
rsync
asked Apr 23 '16 at 10:22
22decembre22decembre
96119
96119
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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)/
)
add a comment |
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.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f278561%2fhow-to-tell-rsync-not-to-delete-some-folders-at-destination%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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)/
)
add a comment |
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)/
)
add a comment |
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)/
)
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)/
)
edited Feb 19 at 18:43


fdehanne
1156
1156
answered Apr 23 '16 at 14:15


Hai Luong DongHai Luong Dong
13115
13115
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Apr 23 '16 at 12:21


CeladaCelada
31k46584
31k46584
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f278561%2fhow-to-tell-rsync-not-to-delete-some-folders-at-destination%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
6jxi5o Y2AnvjFJHqVGPprjDJMb