LoginSignup
1
3

More than 3 years have passed since last update.

[Mac]xargsで引数を任意の箇所に埋め込んで実行するメモ

Posted at

この記事について

何回やっても忘れるので。本当にただのメモ書きです。

sample code

ローカルの特定のディレクトリ配下にあるファイルすべてをS3に上げるサンプルスニペット。

upload_s3.sh
find -f <path_to_dir>/* -print0 | xargs -0 -I{} aws s3 cp  {} s3://my-bucket/prefix/

ポイント

find -Iの後ろに任意の文字列を入れることで、実行する末尾でなく任意の箇所に埋め込むことができる。

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