Skip to content

sync: add pattern-based transfer ordering - #9766

Merged
ncw merged 1 commit into
rclone:masterfrom
CAOShurong:codex/order-by-patterns
Aug 14, 2026
Merged

ncw merged 1 commit into
rclone:masterfrom
CAOShurong:codex/order-by-patterns

Conversation

@CAOShurong

Copy link
Copy Markdown
Contributor

What does this change do?

Adds pattern-based transfer ordering with syntax such as
--order-by 'pattern,*.tar.gz,*.md5'.

Patterns use rclone's existing filter-pattern parser. Files are ranked by the
first matching pattern, unmatched files come last, and full-path ordering makes
ties deterministic. Invalid or missing patterns fail during option parsing.
The documentation covers matching, tie behavior, and the comma limitation.

AI assistance disclosure: OpenAI Codex assisted with implementation and
verification. I read the repository's AI-assisted contribution guidance, ran
the checks below against current master, and take responsibility for the
submitted change.

Verification performed:

  • go test -count=1 ./fs/filter ./fs/sync
  • go vet ./fs/sync
  • go test -race -count=10 -run TestNewLess ./fs/sync/
  • make quicktest BUILD_SOURCEBRANCHNAME=order-by-patterns
  • golangci-lint run ./... (v2.12.2, clean LF checkout): 0 issues
  • CI-equivalent Markdown lint (markdownlint-cli2 v0.18.1): 0 errors
  • Windows CLI copy with --check-first --transfers 1: observed
    a.tar.gz, b.tar.gz, a.md5, b.md5, notes.txt
  • Windows CLI invalid-glob path: exit 7 with bad pattern glob

Linked issue

Fixes #3975

For new or changed backends

Not applicable; this changes sync ordering only.

Checklist

  • This change is trivial OR it has been discussed and agreed in the linked issue.
  • I have read the contribution guidelines.
  • (If I used AI tools to help write this code) I have read and understood the AI-assisted contributions guidance, and I have tested and take ownership of this change myself.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • (Backend changes only) Not applicable; this changes sync ordering only.
  • This Pull Request is ready for review.

Allow --order-by to rank files using comma-separated rclone path globs. Patterns are evaluated in order, unmatched files are placed last, and path ordering makes ties deterministic.

Fixes rclone#3975
@CAOShurong
CAOShurong requested review from ncw and nielash as code owners August 13, 2026 07:02

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice - thank you :-)

@ncw
ncw merged commit bb7c081 into rclone:master Aug 14, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File transfer order pattern

2 participants