@gen.engine
def List(args, callback):
  assert len(args) <= 1
  if len(args) == 0:
    # We intentionally ignore -R when listing buckets, we don't want to traverse all of S3.
    for b in store_utils.ListBuckets():
      print '%s/' % b
  else:
    pattern = args[0]
    res = store_utils.ParseFullPath(pattern)
    if not res:
      logging.warning('%s is not in a registered bucket' % pattern)
    else:
      bucket, path = res
      store = ObjectStore.GetInstance(bucket)
      if options.options.R:
        files = yield gen.Task(store_utils.ListRecursively, store, path)
      else:
        subdirs, files = yield gen.Task(store_utils.ListFilesAndDirs, store, path)
        for d in subdirs:
         print '%s/%s' % (bucket, d)
      for d in files:
        print '%s/%s' % (bucket, d)

  callback()
List buckets/files/directories.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/storage/tools/s3util.py/List