Open docs
CLI Guide

CLI uploads and recovery

Upload files and directories, import large text collections, resume interrupted work, and replace files safely.

Upload files of any type, each up to the service's per-file limit of 10 GB (10,000,000,000 bytes), within your workspace's available storage. flashdrive limits shows the current drive and per-file limits; see limits.

PDF, DOCX and UTF-8 text files, including Markdown, code, CSV and JSON, have their text read, so you can read them by line and grep them. Every other file is stored exactly as it is, with format file. Empty files are stored too.

Upload files and directories

flashdrive upload report.pdf --wait
flashdrive upload a.pdf b.mp4 ./notes --recursive --wait
flashdrive upload ./docs --recursive --dry-run

A directory needs --recursive. Recursive uploads keep the top-level directory and its subfolders, including empty folders. Recursive uploads follow .gitignore. Git data (.git), .env files, system leftovers such as .DS_Store, and symbolic links stay on this machine and are listed. Other hidden files, such as .gitignore and .github, are uploaded. A file that cannot be read is reported on its own while the others continue.

--dry-run reports the planned work without changing anything. Every upload, including a dry run, first reads the service's current per-file limit. A file over it is reported as file_too_large, with the limit in details.max_bytes, and a folder that would hold only refused files is not created. If the limit cannot be read, the upload stops before changing anything.

Use --folder FOLDER to upload into an existing folder (a folder ID, or a name at the drive's top level), or --folder root for the top level.

Uploading the same file again adds another file. To change an existing file, replace it.

Follow progress

The CLI prints a run ID before it sends anything. Save it for recovery. Up to six files transfer at once, and the CLI batches setup, completion and status checks as large as the drive allows.

flashdrive upload ./docs --recursive --wait --timeout 600 --processing-timeout 1800
flashdrive upload status UPLOAD_ID --wait
flashdrive operation status OPERATION_ID --wait
OptionUse
--waitKeep running until each file is stored durably or needs attention. Search readiness is reported separately.
--timeout SECONDSHow long the transfer may take (default 600).
--processing-timeout SECONDSHow long --wait waits for processing (default 600). Needs --wait.

--dry-run cannot be combined with --wait. Work the service has accepted continues if you close the terminal or a wait times out (exit status 12): check on it rather than repeating it.

Resume an interrupted run

flashdrive upload resume RUN_ID --wait

Use the same profile, API origin, workspace and drive. Resuming reuses the saved upload records and skips completed transfers; an unfinished file is sent again from its start. It uses the files and destination saved with the run, so keep the original files in place. To change options, start a new run.

If processing failed, read the error and correct the file before uploading it again. A PDF or DOCX with no selectable text, such as a scan, is kept rather than failed: it is stored and readable, and its document shows text_status none. See upload troubleshooting.

Large uploads

An upload of more than 1,000 files, or more than 1 GB in total, sends its UTF-8 text files as one import and uploads the other files as usual. Imported files are not placed in folders; each keeps its path in metadata.path. Folders are created only where the other files go.

  • Without --wait, the command returns once the import is sealed and prints the flashdrive import ... --resume command that follows it.
  • The import part may take up to 86,400 seconds unless you set --timeout.
  • --no-import uploads every file separately.
  • Uploads to an explicit --folder and replacements always upload each file separately.

If the import stops, run the flashdrive import ... --resume command it printed; the other files keep their run ID for flashdrive upload resume.

Import a large text collection

flashdrive import sends many UTF-8 text files, including Markdown, code, CSV and JSON, in large chunks instead of one upload per file:

flashdrive import ./corpus --drive DRIVE_ID --dry-run
flashdrive import ./corpus --drive DRIVE_ID

One import takes at most 100,000 files and 100,000,000,000 bytes. A larger collection is refused before anything is sent; split it into several imports. See bulk import limits.

Directories are read recursively and follow .gitignore. Git data (.git), .env files, system leftovers such as .DS_Store, symbolic links, empty files and files that are not text are skipped and listed. Other hidden text files, such as .gitignore, are imported. Upload PDF, DOCX and other files with flashdrive upload. Files of up to 31,983,616 bytes fit in one import chunk. Larger files, and files that are not valid UTF-8, are reported and left out; the command then exits with status 1 after the other files are imported.

--dry-run reads the files and reports the documents, chunks and drive limit check without changing anything. Before an import starts, its totals are checked against the limits flashdrive limits shows. The service enforces them either way and answers drive_limit_exceeded when a drive would grow past them.

The command prints the import ID, then progress until the service confirms completion. Completion means the files are stored durably; search readiness is reported separately. The status reports completion_mode and separate stored and searchable counts. --timeout limits reading, uploading and waiting together, in seconds (default 86,400).

Each document's metadata.path holds its file path, starting with the name of the file or directory you named. Paths longer than 2,000 bytes are left out of the metadata. Each external ID starts with the import ID. Two files that would get the same path are refused; import them separately.

While an import is processing, other changes to the same drive, such as uploads and deletions, can be refused for a while. Retry them after the import completes.

Combine small files

flashdrive import ./notes --drive DRIVE_ID --combine-bytes 100000

Consecutive files smaller than the given size (0 to 1,000,000 bytes; 0, the default, turns this off) join into one document of about that size, separated by a blank line. The combined document's metadata.combined_files is a string holding a JSON list of [path, byte offset, byte length] entries, one per file.

Resume or retry an import

flashdrive import ./corpus --drive DRIVE_ID --resume
flashdrive import ./corpus --drive DRIVE_ID --resume --retry-failed

If an import is interrupted, stops on an error or reaches its time limit, run the same command with --resume, using the same paths, profile, API origin, workspace and drive. The CLI continues from a journal in its configuration directory, which holds no credentials, transfer addresses or document text, and does not send accepted chunks again. Keep the files unchanged until the import completes.

ErrorWhat to do
import_operations_failedSome documents could not be processed and can be retried: run the same command with --resume --retry-failed.
import_failedPart of the import failed for good. The CLI closes the import, and error.details.failed_chunk_files lists the files in the failed parts. Some may already be stored, so check before importing them again.
upload_expiredThe import closed. Start a new import for the files that are not stored yet.

Without --resume, the CLI refuses to start a second import of the same paths to the same drive while one is unfinished. --dry-run and --resume cannot be combined, and --retry-failed needs --resume.

Replace or delete a file

Every change to an existing file needs the revision you read, so a change made by someone else in the meantime is never overwritten. Read the file first and use its latest_revision:

flashdrive document get DOCUMENT_ID --json
flashdrive upload handbook.pdf --replace DOCUMENT_ID --expected-revision 7 --wait

Use the revision from your own read in place of 7. If the file changed since then, the command answers stale_version and nothing is written. The CLI never retries with a newer revision; read the file again and decide whether your change still applies.

CommandWhat it does
flashdrive upload FILE --replace DOCUMENT_ID --expected-revision REVISIONReplaces a file with a new one of any type. Keeps its external ID, metadata and folder unless you pass --folder.
flashdrive document replace DOCUMENT_ID FILE --expected-revision REVISIONReplaces the text of a document added as text, from a UTF-8 file of at most 2,000,000 bytes.
flashdrive document move DOCUMENT_ID --to FOLDER --name NEW_NAME --expected-revision REVISIONMoves a file to another folder (--to root for the top level), renames it, or both.
flashdrive document delete DOCUMENT_ID --expected-revision REVISIONDeletes a file. Asks for confirmation; use --yes in scripts.

--expected-revision is required for all four. document replace and document delete return an operation ID right away; follow it with flashdrive operation status OPERATION_ID --wait. Use upload --replace --wait to send a file and wait for it in one command.

To edit part of a file instead of replacing it, see write bytes and edit text, or mount the drive.

Copyright © 2026