LoginSignup
0
0

More than 1 year has passed since last update.

AWS CLIでワイルドカードを使ってS3のファイル削除

Last updated at Posted at 2023-02-13

S3の特定のファイルをまとめて削除

備忘

//dryrun
aws s3 rm s3://hoge/ --exclude '*' --include '*aiueo*' --recursive --dryrun|aws s3 cp - s3://hoge/rmlog.txt
aws s3 rm s3://hoge/ --exclude '*' --include '*aiueo*' --recursive --dryrun|tee rmlog.txt

//結果
aws s3 rm s3://hoge/ --exclude '*' --include '*aiueo*' --recursive|aws s3 cp - s3://hoge/rmlog.txt
aws s3 rm s3://hoge/ --exclude '*' --include '*aiueo*' --recursive|tee rmlog.txt

疑問

cloudshellのローカルに置いたファイルに対してteeすれば標準出力にもlogファイルにも両方書き込みにいけるが
aws s3 cpするとファイル出力のみで標準出力には表示されなくなってしまう…

公式Doc

0
0
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
0
0