fsspec / fsspec/s3fs

[REQUEST] Add --recursive flag to ls()

Open
#652 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1k
Forks
305
Avg merge
22h 37m
Merged PRs (30d)
4

Description

It would be nice if a recursive flag could be added to the ls method, mimicking what is allowed in the AWS CLI.

AWS CLI Example
aws s3 ls s3://my-bucket --recursive

Desired s3fs Example
s3.ls("my-bucket", recursive=True)

I know that glob and expand_path let's you recurse, the only problem is they are slow because my bucket has many sub-buckets and files (~1000). It takes about a second to run the CLI command, but glob and expand_path take about a minute (for my specific s3 bucket, of course). Perhaps I am using them wrong and there is a way of speeding them up.

I couldn't find an open or closed feature request / ticket related to this. Apologies if I somehow missed it or if there is already a way of getting this behavior.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the ls() method and comparing its behavior with the existing glob and expand_path paths; the issue gives an AWS CLI recursive listing as the reference. Confirm how recursive=True should behave for a bucket with many objects, then add coverage showing the requested listing and verify that it avoids the reported performance problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.