![](http://aws-guide.work/wp-content/themes/cocoon-master/images/b-woman.png)
AWS CLIで
・S3上のファイルの一覧を取得
できます!
![](http://aws-guide.work/wp-content/themes/cocoon-master/images/b-woman.png)
「aws s3 ls」コマンドで
取得できます!
サンプルコマンド
ここでは例として
・バケット「tmp12345/sampleDir」配下の
・テキストファイル(txtファイル)の一覧を取得
します。
※バケット「tmp12345/sampleDir」配下には「フォルダ」と「エクセルファイル」もあることとします。
※「フォルダ」と「エクセルファイル」は取得しないようにします。
※今回はコマンドプロンプトでコマンドを実行します。
![バケット「tmp12345/sampleDir」配下には、テキストファイル(txtファイル)が3つある](https://aws-guide.work/wp-content/uploads/2023/12/aws_s3_file_list.png)
構文は以下です。
aws s3 ls バケット名/フォルダ名/ --profile プロファイル名 | findstr 絞り込む文字列
実行例は以下です。
aws s3 ls tmp12345/sampleDir/ --profile develop | findstr txt
実行結果
S3上のファイルの一覧を取得できました。
※テキストファイル(txtファイル)の一覧を取得できました。
![実行結果](https://aws-guide.work/wp-content/uploads/2023/12/aws_s3_file_list_002.png)
参考
「aws s3 ls」の詳細は、公式サイトをご確認ください。