User Tools

Site Tools


rsync_notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rsync_notes [2020/11/22 19:18] rajursync_notes [2021/05/25 12:54] admin
Line 4: Line 4:
  
 Solution: Solution:
 +There are two approaches I can think of. Both work. I prefer the second one as it is a bit cleaner.
 +
 +Approach1:
 <code> <code>
 rsync -prltvzD -n --delete-after --exclude='/*/' source/ destA/ rsync -prltvzD -n --delete-after --exclude='/*/' source/ destA/
 rsync -prltvzD -n --delete-after --include='/*/' --exclude='/*' source/ destB rsync -prltvzD -n --delete-after --include='/*/' --exclude='/*' source/ destB
 </code> </code>
 +
 +Approach2:
 +<code>
 +rsync -prltvzD -n --delete-after --exclude='*/' source/ destA/
 +rsync -prltvzD -n --delete-after --include='*/' --exclude='/*' source/ destB
 +</code>
 +
 +In both approaches, the destA and destB directories will be created on the fly if necessary.
  
 ==== useful links ==== ==== useful links ====
   * https://linuxize.com/post/how-to-exclude-files-and-directories-with-rsync/ - shows how to exclude files and directories with rsync; goes over many cases with examples and simple explanations.   * https://linuxize.com/post/how-to-exclude-files-and-directories-with-rsync/ - shows how to exclude files and directories with rsync; goes over many cases with examples and simple explanations.
  
 +==== miscellaneous ====
 +tags | include all sub directories but exclude top level files, exclude top level directory, exclude all subdirectories
rsync_notes.txt · Last modified: 2021/05/25 12:55 by admin