[student@h006 ~]$ ls dir1 dir2
dir1:
a.dat data.cpio name.data name.list versions.txt
dir2:
[student@h006 ~]$ rsync -av dir1/ dir2/
# ディレクトリの場合は最後に / を付ける。
sending incremental file list
./
a.dat
data.cpio
name.data
name.list
versions.txt
sent 1,568 bytes received 114 bytes 3,364.00 bytes/sec
total size is 1,173 speedup is 0.70
更新されたファイルのみ同期
# touch を使ってタイムスタンプを更新
[student@h006 ~]$ touch dir1/data.cpio
[student@h006 ~]$ ls -l dir?
dir1:
合計 20
-rw-rw-r-- 1 student student 8 7月 22 10:13 a.dat
-rw-rw-r-- 1 student student 512 7月 22 10:30 data.cpio
-rw-r--r-- 1 student student 43 7月 22 10:09 name.data
-rw-rw-r-- 1 student student 43 7月 22 10:09 name.list
-rw-rw-r-- 1 student student 567 7月 22 10:09 versions.txt
dir2:
合計 20
-rw-rw-r-- 1 student student 8 7月 22 10:13 a.dat
-rw-rw-r-- 1 student student 512 7月 22 10:11 data.cpio
-rw-r--r-- 1 student student 43 7月 22 10:09 name.data
-rw-rw-r-- 1 student student 43 7月 22 10:09 name.list
-rw-rw-r-- 1 student student 567 7月 22 10:09 versions.txt
[student@h006 ~]$ rsync -av dir1/ dir2/
sending incremental file list
data.cpio
sent 732 bytes received 35 bytes 1,534.00 bytes/sec
total size is 1,173 speedup is 1.53
削除された内容の反映
[student@h006 ~]$ rm dir1/data.cpio
[student@h006 ~]$ rsync -av --delete dir1/ dir2/
sending incremental file list
deleting data.cpio
./
sent 152 bytes received 28 bytes 360.00 bytes/sec
total size is 661 speedup is 3.67
ネットワークを介した同期
[student@h006 ~]$ rsync -av dir1/ ycos:dir1/
ycos2@ycos2.sakura.ne.jp's password:
sending incremental file list
./
a.dat
name.data
name.list
versions.txt
sent 960 bytes received 98 bytes 49.21 bytes/sec
total size is 661 speedup is 0.62