Automatically create missing parent directories for filesystem write operations
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
Context
Currently, several filesystem write operations in Nextcloud require clients to manually verify and/or create parent directories before performing the actual operation.
This applies in particular to:
• file uploads (PUT)
• MOVE operations
• directory creation (MKCOL)
Clients are therefore forced to:
• perform additional PROPFIND / MKCOL calls
• re-implement filesystem logic already known by the server
• handle race conditions when directories are created concurrently
This proposal moves this responsibility to the server.
What does
This proposal ensures that all filesystem write operations automatically create missing parent directories, recursively, when needed.
The behavior applies to:
• file uploads (PUT)
• MOVE operations
• directory creation (MKCOL)
If a target path includes one or more non-existing parent directories, the server will:
• create the full directory chain automatically
• proceed with the requested operation
• behave idempotently if directories already exist
Examples
Upload (PUT)
Uploading to: /files/user/Photos/2025/01/image.jpg
will automatically create:
Photos/
Photos/2025/
Photos/2025/01/
MOVE
Moving a file to: /files/user/Archive/2024/Reports/file.pdf
will automatically create all missing parent directories before executing the MOVE.
MKCOL
Creating a directory at: /files/user/Projects/Nextcloud/iOS
will automatically create:
Projects/
Projects/Nextcloud/
Projects/Nextcloud/iOS/
even if intermediate directories do not exist.
Why this matters
• Eliminates redundant client-side directory checks
• Prevents race conditions between concurrent clients
• Reduces network round-trips
• Aligns Nextcloud behavior with modern object-storage semantics
• Simplifies client implementations (mobile, desktop, WebDAV clients)
Scope & compatibility
• No API changes
• No client behavior regression
• Existing clients continue to work unchanged
• New behavior is additive and backward compatible
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the server entry points for PUT, MOVE, and MKCOL, then inspect how parent-directory handling currently works for each operation. Check how recursive creation, idempotency, errors, and concurrent requests are tested. Done means all three operations create missing parent chains while preserving existing-client behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100