Folders and files
Folders in a drive work like folders on a laptop: they nest, and you can create whole trees, move and rename folders and files, and delete a folder with everything in it. A file's path is its folder names and file name joined by /, such as policies/2026/refunds.pdf. It follows the file when you move or rename a folder above it.
The API and SDK call a file a document and identify it by document_id.
In the Console
- Open the drive from Drives or the sidebar.
- Select New folder to create a folder, or open a folder first to create one inside it.
- Select Upload files, or drag files onto the page. Drag a whole folder to upload it with its folder tree.
- Browse a folder to review file names and sizes. Open a file to delete it.
Use the CLI, SDK, MCP or the API to move, rename or delete folders, and to move or rename files.
Organize with the CLI, SDK or an agent
| Task | CLI | Python | MCP tool |
|---|---|---|---|
| Create a folder tree | flashdrive folder ensure reports/2026/q3 | client.folders.ensure(["reports/2026/q3"]) | ensure_folders |
| Create one folder | flashdrive folder create NAME --folder PARENT_ID | client.folders.create("q3", parent_folder_id=...) | create_folder |
| Rename a folder | flashdrive folder rename FOLDER_ID NEW_NAME | client.folders.rename(folder_id, "new") | rename_folder |
| Move a folder (and rename it) | flashdrive folder move FOLDER_ID --to PARENT_ID (--to root for the top level, --name NEW) | client.folders.move(folder_id, parent_folder_id, name=None) | move_folder |
| Move or rename a file | flashdrive document move DOCUMENT_ID --to FOLDER_ID --name NEW --expected-revision REV | client.documents.move(document_id, folder_id, expected_revision=...) and client.documents.rename(document_id, "new.txt", expected_revision=...) | move_file |
| Delete a file | flashdrive document delete DOCUMENT_ID --expected-revision REV --yes | client.documents.delete(document_id, expected_revision=...) | delete_document |
| Delete an empty folder | flashdrive folder delete FOLDER_ID --yes | client.folders.delete(folder_id) | delete_folder |
| Delete a folder and everything in it | flashdrive folder delete FOLDER_ID --recursive --yes | client.folders.delete(folder_id, recursive=True) | delete_folder with recursive, then continue_folder_deletion |
folder ensure reuses folders that already exist and creates the rest. flashdrive upload PATH --recursive also creates the folder tree of a local folder.
Folder rules
- Folders nest up to 64 levels deep, and a whole folder path is at most 1,024 bytes.
- A folder name is 1 to 120 characters, never
.or.., with no/or control characters. - A file name is at most 255 bytes, with no
/,\or control characters. - Moving or renaming a folder takes its files and subfolders with it. A file keeps its
document_idwhen you move or rename it.
A change that breaks these rules is refused with an error you can act on:
| Error | Cause | What to do |
|---|---|---|
folder_too_deep | The move or new folder would go past 64 levels or 1,024 bytes of path. | Choose a shallower destination or shorter names. |
folder_cycle | A folder would move into itself or one of its own subfolders. | Choose a destination outside the folder. |
duplicate_name | A move or rename would give a folder or file the name of another one beside it. | Rename it, or choose another destination. |
folder_not_empty | You deleted a folder that still holds files or folders, without recursive. | Delete with --recursive (or recursive=True) if you mean to remove everything in it. |
Change a file without overwriting anyone
Every change to an existing file names the revision it started from: --expected-revision or --revision in the CLI, expected_revision or revision in the SDK, and version in the MCP tools. If the file changed since you read it, the change is refused with stale_version and nothing is written. Read the file again, and redo the change only if it still applies.
| Task | CLI | Python | MCP tool |
|---|---|---|---|
| Replace exact text in a text file | flashdrive file edit DOCUMENT_ID --old TEXT --new TEXT --revision REV | client.files.edit_text(document_id, edits, revision=...) | edit_text |
| Write bytes at an offset, or append | flashdrive file patch DOCUMENT_ID PART_FILE --offset N --revision REV (or --append) | client.files.write_bytes(document_id, data, revision=..., offset=N) | write_bytes, or edit_file for larger edits |
| Replace a whole file | flashdrive upload FILE --replace DOCUMENT_ID --expected-revision REV | client.documents.replace_file(document_id, path, expected_revision=...) | prepare_upload |
A text edit replaces each exact old text, which must occur once in the file, with its new text; the edits apply in order, all or nothing. edit_text works on text up to 8 MiB. One write_bytes call writes up to 32,768 bytes; flashdrive file patch and edit_file send up to 64 MiB per request. See find files for reading the revision.
Conflict copies
A mounted drive or a working copy saves your edits when you are done with a file. If the drive's version changed in the meantime, nothing is overwritten: the other version is kept beside the file as a recovery copy such as name (conflict 20261114T010203Z a1b2c3d4).ext.
To resolve one, compare the copy with the original. Merge the changes into one file, then delete the copy, or rename it if you want to keep both. To find recovery copies, use the recovery MCP tool or glob for '* (conflict *'.
Delete and restore
A deleted file can be restored within one hour of its deletion. After that it is gone. That holds however the file was deleted: on its own, with its folder, or with up to 1,000 others in one request. Until it is gone, a deleted file still counts towards the drive's size. Restoring a file does not recreate folders that were deleted with it, and a restored file needs a name that is free in its destination.
A recursive folder delete removes the folders at once and deletes their files in steps. The CLI and SDK carry on until the deletion finishes. If one stops early (after --no-wait or wait=False, a timeout, or repeated failures), finish it with flashdrive folder continue-delete OPERATION_ID or client.folders.continue_deletion(deletion). Check what a folder holds before you delete it.
To delete a drive, see delete a drive.
Stable IDs and labels
For repeatable imports through the SDK or API, give each file a stable external_id within the drive, and add small metadata labels such as source or owner. See replace files and labels.
Refresh the Console page if a teammate or an agent has changed the drive since you opened it. See the content API for every route.