3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rsyncで特定のファイルだけ同期しないようにする

Posted at

jenkinsでのビルドを行っていた時に、laravelの.envファイルは同期したくなかったので使いました。

書き方としては、--exclude="***"とすればOKなのですが、注意しないといけないのは、同期元ディレクトリからの相対パスで書かないと行けないので、絶対パスで書くと正しく認識されないことです。

  • 具体的な設定例
rsync -rlptgoD --delete --exclude .env /web/dev.hoge/public/ /web/hoge/

こうすると、/web/dev.hoge/public/.envファイルは同期されなくなります。

また、同期したくないファイルが多い場合は、exclude-fromというオプションでファイル毎指定出来るみたいなので、明朝にでもその方法も追記します。

3
4
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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?