tar_and_rsync_file_exclusion
Table of Contents
If you want to send us your comments, please do so. Thanks
More on comments
tar and rsync file exclusion
Exclusion of directories and their contents
Program | aa | bb/ | cc/* |
---|---|---|---|
rsync | Excluded | Excluded | Only contents excluded |
tar | Excluded | Not excluded | Only contents excluded |
--exclude-from
--exclude-from=excludefile.txt
Proof of concept
Exclude file
aa bb/ cc/* 7.txt cc.31.txt
Program
#! /bin/bash sdir=/tmp/tarrsyncsource ddir1=/tmp/tarrsycndestination1 ddir2=/tmp/tarrsycndestination2 mkdir $sdir $ddir $sdir/aa $sdir/bb $sdir/cc for i in {1..40}; do if [[ $i -lt 10 ]]; then touch $sdir/$i.txt fi if [[ $i -ge 10 && $i -lt 20 ]]; then touch $sdir/aa/aa.$i.txt fi if [[ $i -ge 20 && $i -lt 30 ]]; then touch $sdir/bb/bb.$i.txt fi if [[ $i -ge 30 ]]; then touch $sdir/cc/cc.$i.txt fi done rsync -avv --exclude-from=tarrsync.exclude.txt $sdir $ddir1 # copies /tmp/tarrsyncsource into /tmp/tarrsycndestination1 rsync -avv --exclude-from=tarrsync.exclude.txt $sdir/ $ddir2 # copies only the contents of /tmp/tarrsyncsource into /tmp/tarrsycndestination2
Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy
RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2024 Webevaluation.nl and the authors
Changes reserved.
tar_and_rsync_file_exclusion.txt · Last modified: 07-07-2021 09:33 by wim