feat: add --start-after flag for the ls command#850
Open
pashagolub wants to merge 1 commit intopeak:masterfrom
Open
feat: add --start-after flag for the ls command#850pashagolub wants to merge 1 commit intopeak:masterfrom
--start-after flag for the ls command#850pashagolub wants to merge 1 commit intopeak:masterfrom
Conversation
This commit adds support for the `--start-after` parameter to enable pagination when listing S3 objects, allowing users to resume listing from a specific key. Changes: - storage/url: Add StartAfter field to URL struct and WithStartAfter() option function for constructing URLs with pagination support - storage/s3: Update listObjectsV2() to pass StartAfter parameter to AWS S3 ListObjectsV2 API call - command/ls: Add --start-after CLI flag with validation and help text - README.md: Add "Listing objects with pagination" section with usage examples demonstrating basic and advanced use cases - e2e/ls_test: Add comprehensive integration tests for --start-after functionality including: * Basic pagination with bucket root * Pagination with prefix filtering * Pagination with wildcard patterns * Pagination with wildcard and extension filtering Tests skip on gofakes3 mock backend (which doesn't properly implement the StartAfter parameter) and run when S5CMD_TEST_ENDPOINT_URL is configured to point to a real S3-compatible endpoint. Verified against: - AWS S3 public bucket (globalnightlight) - MinIO server (localhost:9000) Example usage: s5cmd ls --start-after "logs/2024/file2.txt" s3://bucket/logs/2024/ s5cmd ls --start-after "b.txt" s3://bucket/*.txt Fixes pagination for large buckets and enables efficient incremental listing workflows.
terryrankine
added a commit
to terryrankine/s5cmd
that referenced
this pull request
Mar 18, 2026
Add --start-after flag to the ls command to support listing S3 objects starting after a specific key. Useful for pagination and resuming listings from a specific point. Passes StartAfter to the S3 ListObjectsV2 API. (peak#850) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds support for the
--start-afterparameter to enable pagination when listing S3 objects, allowing users to resume listing from a specific key.Changes:
Tests skip on gofakes3 mock backend (which doesn't properly implement the StartAfter parameter) and run when S5CMD_TEST_ENDPOINT_URL is configured to point to a real S3-compatible endpoint.
Verified against:
Example usage:
s5cmd ls --start-after "logs/2024/file2.txt" s3://bucket/logs/2024/ s5cmd ls --start-after "b.txt" s3://bucket/*.txt
Fixes pagination for large buckets and enables efficient incremental listing workflows.