使用oss python sdk罗列某目录下所有文件。

 

#!/usr/bin/python3

import sys, os
import oss2

auth = oss2.Auth('keyID', 'keySecret')
bucket = oss2.Bucket(auth, 'url', 'bucket', enable_crc=False)

is_truncated = True
next_marker = ''
while(is_truncated):
    result = bucket.list_objects(prefix="", marker=next_marker, max_keys=1000)
    is_truncated = result.is_truncated
    next_marker = result.next_marker
    oss_objects = result.object_listfor oss_object in oss_objects:
        print('find: ' + oss_object.key)

 

相关文章:

  • 2021-08-05
  • 2021-05-27
  • 2022-12-23
  • 2022-01-10
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-20
  • 2022-02-20
  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案