LoginSignup
8
9

More than 5 years have passed since last update.

Linuxでファイルのパーミッションをコピーする方法

Posted at

コピー元ファイルを file1 、コピー先ファイルを file2 とした時、
chmod --reference file1 file2
とします。

2つののディレクトリ配下のすべてのファイルのパーミッションを合わせたい場合は、以下のようにします。
コピー元のディレクトリを dir1 、コピー先のディレクトリを dir2 として、dir1 に移動した状態で、以下を実行します。
find . -type f | xargs -I {} chmod --reference {} ../dir2/{}

参考)
Copy file permissions, but not files

8
9
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
8
9