Help us understand the problem. What is going on with this article?


More than 3 years have passed since last update.


sudo rsync -rOtv -e 'ssh -c' /mnt/data1 taro@server1:/mnt/client1/data1
# r: 再帰的に実行
# t: タイムスタンプを反映
# O: ディレクトリのタイムスタンプを無視
# v: 過程を表示



src="/mnt/data1" &&
src_tmp="/tmp/data1" &&
ssh=taro@server1 &&
dest_tmp="/tmp/data1" &&
dest="/mnt/client1/data1" &&
cd "$src" ; find . -type d -exec mkdir -p "$src_tmp/{}" \; && # ディレクトリだけをコピー
cd "$src" ; find . -exec touch -r "{}" "$src_tmp/{}" \; && # タイムスタンプが同一の空のファイルを作成
rsync -rtv -e ssh "$src_tmp/" $ssh:"'$dest_tmp'" && # サーバに空のファイルをコピー
ssh $ssh bash -c "'cd \"$dest_tmp\" ; find . -exec touch -r \"{}\" \"$dest/{}\" \;'" # タイムスタンプを反映
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away