Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
25
rated 0 times [  25] [ 0]  / answers: 1 / hits: 35100  / 3 Years ago, sun, june 27, 2021, 2:41:21

Okay so I have looked up the existing answers here and elsewhere but what I can't find out is, if I use the --ignore-existing option along with the --delete option, will this combination I still be able to have rsync delete files from the target if they no longer exist in the source AND still prevent rsync from overwriting existing files in the target?



Thanks


More From » 12.04

 Answers
1

Yes, --delete and --ignore-existing options of rsync will work together.



Here is a test (check the modification times especially):



:~/foo$ ls -l
-rw-rw-r-- 1 user user 0 Mar 27 14:38 egg.txt
-rw-rw-r-- 1 user user 0 Mar 27 14:38 ignore.txt
-rw-rw-r-- 1 user user 0 Mar 27 14:38 spam.txt

:~/bar$ ls -l
-rw-rw-r-- 1 user user 0 Mar 27 14:40 ignore.txt
-rw-rw-r-- 1 user user 0 Mar 27 14:40 remove.txt

$ rsync -r --delete --ignore-existing ~/foo/ ~/bar/

:~/bar$ ls -l
-rw-rw-r-- 1 user user 0 Mar 27 14:42 egg.txt
-rw-rw-r-- 1 user user 0 Mar 27 14:40 ignore.txt
-rw-rw-r-- 1 user user 0 Mar 27 14:42 spam.txt

[#20774] Sunday, June 27, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ilityushing

Total Points: 18
Total Questions: 100
Total Answers: 113

Location: Senegal
Member since Wed, May 13, 2020
4 Years ago
ilityushing questions
Sat, Apr 1, 23, 03:07, 1 Year ago
Wed, Mar 2, 22, 12:25, 2 Years ago
Tue, Jun 15, 21, 14:34, 3 Years ago
Sun, Aug 15, 21, 18:44, 3 Years ago
;