page counter next up previous contents
Next: 遠端同步 Up: Rsync 檔案備援 Previous: 用法四-刪除排外   Contents   DYWANG_HOME

用法五-排除特定檔案

  1. 刪除之前同步的資料。
    [root@kvm5 ~]# rm -rf /home/deyu1/cron.daily
    
  2. 以選項 -exclude 排除副檔名是 cron 的檔案。
    [root@kvm5 ~]# rsync -avh --exclude='*.cron' /etc/cron.daily /home/deyu1/
    sending incremental file list
    cron.daily/
    cron.daily/logrotate
    
    sent 293 bytes  received 35 bytes  656.00 bytes/sec
    total size is 180  speedup is 0.55
    
  3. 同步資料中只有 logrotate 一個檔。
    [root@kvm5 ~]# ll /home/deyu1/cron.daily/
    total 2
    -rwx------. 1 root root 180 Jul 31  2013 logrotate
    



De-Yu Wang 2020-05-14