Linux - Synchronise 2 Directories: Difference between revisions

From PiRho Knowledgebase
Jump to navigationJump to search
Use RSynch
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
rsync -avu --delete "/home/user/A/" "/home/user/B"
[[Category:Linux]]
-a archive mode; equals -rlptgoD (no -H, -A, -X)
[[Category:rsync]]
-v run verbosely
<code>rsync -avu --delete "/home/user/A/" "/home/user/B"</code>
-u only copy files with a newer modification time (or size difference if the times are equal)
;-a
--delete delete the files in target folder that do not exist in the source
: archive mode; equals -rlptgoD (no -H, -A, -X)
Reference: https://unix.stackexchange.com/questions/203846/how-to-sync-two-folders-with-command-line-tools
;-v
: run verbosely
;-u
: only copy files with a newer modification time (or size difference if the times are equal)
;--delete
: delete the files in target folder that do not exist in the source
Reference: [https://unix.stackexchange.com/questions/203846/how-to-sync-two-folders-with-command-line-tools Stack Exchange: How to sync two folders with command line tools?]

Latest revision as of 12:53, 6 March 2025

rsync -avu --delete "/home/user/A/" "/home/user/B"

-a
archive mode; equals -rlptgoD (no -H, -A, -X)
-v
run verbosely
-u
only copy files with a newer modification time (or size difference if the times are equal)
--delete
delete the files in target folder that do not exist in the source

Reference: Stack Exchange: How to sync two folders with command line tools?