Quick way to list all files in Amazon S3 bucket?

前端 未结 28 1843
星月不相逢
星月不相逢 2020-11-28 01:32

I have an amazon s3 bucket that has tens of thousands of filenames in it. What\'s the easiest way to get a text file that lists all the filenames in the bucket?

28条回答
  •  情话喂你
    2020-11-28 01:39

    AWS CLI

    Documentation for aws s3 ls

    AWS have recently release their Command Line Tools. This works much like boto and can be installed using sudo easy_install awscli or sudo pip install awscli

    Once you have installed, you can then simply run

    aws s3 ls
    

    Which will show you all of your available buckets

    CreationTime Bucket
           ------------ ------
    2013-07-11 17:08:50 mybucket
    2013-07-24 14:55:44 mybucket2
    

    You can then query a specific bucket for files.

    Command:

    aws s3 ls s3://mybucket
    

    Output:

    Bucket: mybucket
    Prefix:
    
          LastWriteTime     Length Name
          -------------     ------ ----
                               PRE somePrefix/
    2013-07-25 17:06:27         88 test.txt
    

    This will show you all of your files.

提交回复
热议问题