35
28

More than 5 years have passed since last update.

rsyncでディレクトリごとコピー

Posted at

ついでにsshもしてる…。

rsync -auz -e ssh ~/public/dir/ <目的のサーバー>:~/public

これだとdir 配下の物が、publicにコピーされる。

rsync -auz -e ssh ~/public/dir <目的のサーバー>:~/public

こちらは dir自体が、publicにコピーされる。

転送元のディレクトリの終わりに/をつけるかつけないかがポイントです。

オプション 意味
a よしなに保存
u 新しいファイルを転送
z 圧縮して転送
e ssh sshにする

おまけ

ssh しないでコピーだけする場合

rsync -auz ~/public/dir ~/public_copy
35
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
28