Why does 'rsync' overwrite files in my destination with the same contents? The 2019 Stack...

Why can't devices on different VLANs, but on the same subnet, communicate?

Using dividends to reduce short term capital gains?

Did the new image of black hole confirm the general theory of relativity?

How do I design a circuit to convert a 100 mV and 50 Hz sine wave to a square wave?

Windows 10: How to Lock (not sleep) laptop on lid close?

Single author papers against my advisor's will?

Why are PDP-7-style microprogrammed instructions out of vogue?

How to read αἱμύλιος or when to aspirate

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

How do you keep chess fun when your opponent constantly beats you?

What do I do when my TA workload is more than expected?

Make it rain characters

Do warforged have souls?

How to make Illustrator type tool selection automatically adapt with text length

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

What force causes entropy to increase?

Button changing its text & action. Good or terrible?

Example of compact Riemannian manifold with only one geodesic.

Define a list range inside a list

Can each chord in a progression create its own key?

Circular reasoning in L'Hopital's rule

Drawing vertical/oblique lines in Metrical tree (tikz-qtree, tipa)

Can we generate random numbers using irrational numbers like π and e?



Why does 'rsync' overwrite files in my destination with the same contents?



The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
2019 Community Moderator Election ResultsCannot get rsync to keep source file ownership, tried many tricksrsync --delete deleted most files in the destination directory, why?The most *robust* remote file copy?Smarter filetransfers than rsync?Delete destination directories with rsync (contents as well as parent)Is rsync the fastest and most reliable way to verify whether directories are identical?rsync and changing destination files to hardlinksUse rsync to mirror source for website deployment, but not delete selected files in destinationrsync with remove extra lines in destinationDoes rsync completely overwrite files with different timestamps?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I'm using rsync in a shell script to perform deployments of Bitbucket (Git) managed repositories. Part of the requirements for deployment is that files from several designated directories in source are aggregated into a "Common" folder in the destination. If files in these designated directories are in subdirectories, then these get copied over also.



Say "Templates" and "Webforms" are a designated directories, then it would work as follows:



Proj/Templates/t_x.html                 =>  Proj/Common/t_x.html
Proj/Templates/modal/t_y.html => Proj/Common/modal/t_y.html
Proj/Webforms/wf_x.html => Proj/Common/wf_x.html
Proj/Webforms/mobile/android/wf_y.html => Proj/Common/mobile/android/wf_y.html


To handle this, I loop through a list of the designated directories defined in an associative array like DIRLIST[dirname] = '/dest/dir', and use find to locate the directories to rsync. I then substitute the directory in a variable passed to rsync. This looks like the following:



for dirname in "${!DIRLIST[@]}"
find . -type d -name "$dirname" | while read line; do
SUBDIR="${PROJ_PATH}/Common/${DIRLIST[$dirname]}"
if ls -1qA "${line}/" | grep -q
then
rsync -vrpgocuI -e "ssh <some ssh stuff>" "${SOUCRE}/" "${SUBPATH}"
fi
done
done


Since GIT doesn't preserve the file modification time, I'm forced to use the --checksum (-c) option. The problem is that, despite using checksum, rsync seems to overwrite files that already exist on the destination side. I've verified this by doing a file diff and both files on the source and destination are identical. Perhaps coincidental, but strangely enough, it only affect files that have the extenstion .efx



So these files wouldn't be affected



Proj/Common/t_x.html
Proj/Common/modal/t_y.html


But these would



Proj/Common/e_x.efx
Proj/Common/modal/e_x.efx


I tried to configure my rsync flags to handle this as best as possible but it's still overwriting the files. Info sec restricts us from using non-approved third-party tools, so I can't use something like vimdiff. If I use diff over ssh, that would require the remote directory to be sync'd locally and the project is too large for that to be feasible.



Does anyone have any suggestions for what might be causing this behavior, for how to modify my rsync command, or for a different approach than the one I've described?



So far I've tried using several combinations of --ignore-times, --checksum, and --size-only, but this seems to have minimal effect.










share|improve this question







New contributor




user3100306 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Run with -i or --itemize-changes and add the output from those files in your question.

    – BowlOfRed
    3 hours ago




















0















I'm using rsync in a shell script to perform deployments of Bitbucket (Git) managed repositories. Part of the requirements for deployment is that files from several designated directories in source are aggregated into a "Common" folder in the destination. If files in these designated directories are in subdirectories, then these get copied over also.



Say "Templates" and "Webforms" are a designated directories, then it would work as follows:



Proj/Templates/t_x.html                 =>  Proj/Common/t_x.html
Proj/Templates/modal/t_y.html => Proj/Common/modal/t_y.html
Proj/Webforms/wf_x.html => Proj/Common/wf_x.html
Proj/Webforms/mobile/android/wf_y.html => Proj/Common/mobile/android/wf_y.html


To handle this, I loop through a list of the designated directories defined in an associative array like DIRLIST[dirname] = '/dest/dir', and use find to locate the directories to rsync. I then substitute the directory in a variable passed to rsync. This looks like the following:



for dirname in "${!DIRLIST[@]}"
find . -type d -name "$dirname" | while read line; do
SUBDIR="${PROJ_PATH}/Common/${DIRLIST[$dirname]}"
if ls -1qA "${line}/" | grep -q
then
rsync -vrpgocuI -e "ssh <some ssh stuff>" "${SOUCRE}/" "${SUBPATH}"
fi
done
done


Since GIT doesn't preserve the file modification time, I'm forced to use the --checksum (-c) option. The problem is that, despite using checksum, rsync seems to overwrite files that already exist on the destination side. I've verified this by doing a file diff and both files on the source and destination are identical. Perhaps coincidental, but strangely enough, it only affect files that have the extenstion .efx



So these files wouldn't be affected



Proj/Common/t_x.html
Proj/Common/modal/t_y.html


But these would



Proj/Common/e_x.efx
Proj/Common/modal/e_x.efx


I tried to configure my rsync flags to handle this as best as possible but it's still overwriting the files. Info sec restricts us from using non-approved third-party tools, so I can't use something like vimdiff. If I use diff over ssh, that would require the remote directory to be sync'd locally and the project is too large for that to be feasible.



Does anyone have any suggestions for what might be causing this behavior, for how to modify my rsync command, or for a different approach than the one I've described?



So far I've tried using several combinations of --ignore-times, --checksum, and --size-only, but this seems to have minimal effect.










share|improve this question







New contributor




user3100306 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Run with -i or --itemize-changes and add the output from those files in your question.

    – BowlOfRed
    3 hours ago
















0












0








0








I'm using rsync in a shell script to perform deployments of Bitbucket (Git) managed repositories. Part of the requirements for deployment is that files from several designated directories in source are aggregated into a "Common" folder in the destination. If files in these designated directories are in subdirectories, then these get copied over also.



Say "Templates" and "Webforms" are a designated directories, then it would work as follows:



Proj/Templates/t_x.html                 =>  Proj/Common/t_x.html
Proj/Templates/modal/t_y.html => Proj/Common/modal/t_y.html
Proj/Webforms/wf_x.html => Proj/Common/wf_x.html
Proj/Webforms/mobile/android/wf_y.html => Proj/Common/mobile/android/wf_y.html


To handle this, I loop through a list of the designated directories defined in an associative array like DIRLIST[dirname] = '/dest/dir', and use find to locate the directories to rsync. I then substitute the directory in a variable passed to rsync. This looks like the following:



for dirname in "${!DIRLIST[@]}"
find . -type d -name "$dirname" | while read line; do
SUBDIR="${PROJ_PATH}/Common/${DIRLIST[$dirname]}"
if ls -1qA "${line}/" | grep -q
then
rsync -vrpgocuI -e "ssh <some ssh stuff>" "${SOUCRE}/" "${SUBPATH}"
fi
done
done


Since GIT doesn't preserve the file modification time, I'm forced to use the --checksum (-c) option. The problem is that, despite using checksum, rsync seems to overwrite files that already exist on the destination side. I've verified this by doing a file diff and both files on the source and destination are identical. Perhaps coincidental, but strangely enough, it only affect files that have the extenstion .efx



So these files wouldn't be affected



Proj/Common/t_x.html
Proj/Common/modal/t_y.html


But these would



Proj/Common/e_x.efx
Proj/Common/modal/e_x.efx


I tried to configure my rsync flags to handle this as best as possible but it's still overwriting the files. Info sec restricts us from using non-approved third-party tools, so I can't use something like vimdiff. If I use diff over ssh, that would require the remote directory to be sync'd locally and the project is too large for that to be feasible.



Does anyone have any suggestions for what might be causing this behavior, for how to modify my rsync command, or for a different approach than the one I've described?



So far I've tried using several combinations of --ignore-times, --checksum, and --size-only, but this seems to have minimal effect.










share|improve this question







New contributor




user3100306 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'm using rsync in a shell script to perform deployments of Bitbucket (Git) managed repositories. Part of the requirements for deployment is that files from several designated directories in source are aggregated into a "Common" folder in the destination. If files in these designated directories are in subdirectories, then these get copied over also.



Say "Templates" and "Webforms" are a designated directories, then it would work as follows:



Proj/Templates/t_x.html                 =>  Proj/Common/t_x.html
Proj/Templates/modal/t_y.html => Proj/Common/modal/t_y.html
Proj/Webforms/wf_x.html => Proj/Common/wf_x.html
Proj/Webforms/mobile/android/wf_y.html => Proj/Common/mobile/android/wf_y.html


To handle this, I loop through a list of the designated directories defined in an associative array like DIRLIST[dirname] = '/dest/dir', and use find to locate the directories to rsync. I then substitute the directory in a variable passed to rsync. This looks like the following:



for dirname in "${!DIRLIST[@]}"
find . -type d -name "$dirname" | while read line; do
SUBDIR="${PROJ_PATH}/Common/${DIRLIST[$dirname]}"
if ls -1qA "${line}/" | grep -q
then
rsync -vrpgocuI -e "ssh <some ssh stuff>" "${SOUCRE}/" "${SUBPATH}"
fi
done
done


Since GIT doesn't preserve the file modification time, I'm forced to use the --checksum (-c) option. The problem is that, despite using checksum, rsync seems to overwrite files that already exist on the destination side. I've verified this by doing a file diff and both files on the source and destination are identical. Perhaps coincidental, but strangely enough, it only affect files that have the extenstion .efx



So these files wouldn't be affected



Proj/Common/t_x.html
Proj/Common/modal/t_y.html


But these would



Proj/Common/e_x.efx
Proj/Common/modal/e_x.efx


I tried to configure my rsync flags to handle this as best as possible but it's still overwriting the files. Info sec restricts us from using non-approved third-party tools, so I can't use something like vimdiff. If I use diff over ssh, that would require the remote directory to be sync'd locally and the project is too large for that to be feasible.



Does anyone have any suggestions for what might be causing this behavior, for how to modify my rsync command, or for a different approach than the one I've described?



So far I've tried using several combinations of --ignore-times, --checksum, and --size-only, but this seems to have minimal effect.







shell-script rsync






share|improve this question







New contributor




user3100306 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




user3100306 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




user3100306 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 7 hours ago









user3100306user3100306

1




1




New contributor




user3100306 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user3100306 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user3100306 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Run with -i or --itemize-changes and add the output from those files in your question.

    – BowlOfRed
    3 hours ago





















  • Run with -i or --itemize-changes and add the output from those files in your question.

    – BowlOfRed
    3 hours ago



















Run with -i or --itemize-changes and add the output from those files in your question.

– BowlOfRed
3 hours ago







Run with -i or --itemize-changes and add the output from those files in your question.

– BowlOfRed
3 hours ago












0






active

oldest

votes












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
});


}
});






user3100306 is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512135%2fwhy-does-rsync-overwrite-files-in-my-destination-with-the-same-contents%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








user3100306 is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















user3100306 is a new contributor. Be nice, and check out our Code of Conduct.













user3100306 is a new contributor. Be nice, and check out our Code of Conduct.












user3100306 is a new contributor. Be nice, and check out our Code of Conduct.
















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512135%2fwhy-does-rsync-overwrite-files-in-my-destination-with-the-same-contents%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...