File Management Commands
The Flywheel CLI provides four commands for browsing and managing individual files: fw ls, fw cp, fw upload, and fw download. These commands mirror standard terminal file system commands, making it easy to work with data on Flywheel.
Single-File Operations
These commands are designed for working with individual files or containers. For bulk operations involving many files, see:
- Ingest Commands - Import large datasets
- Export Commands - Export data in bulk
- Sync Command - Synchronize data to external storage
The fw ls Command
Browse the Flywheel hierarchy using fw ls, similar to the standard ls command for listing directories.
Usage
Arguments
| Argument | Required | Description |
|---|---|---|
path | No | The Flywheel path to list (e.g., group/project/subject). If omitted, lists all groups. |
Optional Arguments
| Optional Argument | Description |
|---|---|
--ids | Display database identifiers for each container |
-a, --all | Show all containers and files |
| Optional Argument | Description |
|---|---|
-h, --help | Show help message and exit. |
-C PATH, --config-file | Specify configuration options via config file.* |
--no-config | Do NOT load the default configuration file. |
-y, --yes | Assume the answer is yes to all prompts. |
--ca-certs CA_CERTS | Path to a local Certificate Authority certificate bundle file. This option may be required when using a private Certificate Authority. |
--timezone TIMEZONE | Set the effective local timezone to use when uploading data. |
-q, --quiet | Squelch log messages to the console. |
-d, --debug | Turn on debug logging. |
-v, --verbose | Get more detailed output. |
* Learn more about how to create this file.
Examples
List all groups
Output:
The output shows permission level followed by group name.
List projects in a group
Output:
List subjects in a project
Output:
Navigate the full hierarchy
Show database IDs
This displays the internal Flywheel database ID alongside each container name, useful for API operations.
Understanding the Hierarchy
Flywheel organizes data in a hierarchical structure:
Use fw ls to navigate each level, just like navigating directories on your local filesystem.
Handling Spaces in Names
If a container name includes spaces, use quotes:
The fw cp Command
Copy files between your local filesystem and Flywheel, or between Flywheel locations, using fw cp.
Usage
Required Arguments
| Required Argument | Description |
|---|---|
source | The source path (local file or Flywheel path using fw://) |
destination | The destination path (local file or Flywheel path using fw://) |
Optional Arguments
| Optional Argument | Description |
|---|---|
-h, --help | Show help message and exit. |
-C PATH, --config-file | Specify configuration options via config file.* |
--no-config | Do NOT load the default configuration file. |
-y, --yes | Assume the answer is yes to all prompts. |
--ca-certs CA_CERTS | Path to a local Certificate Authority certificate bundle file. This option may be required when using a private Certificate Authority. |
--timezone TIMEZONE | Set the effective local timezone to use when uploading data. |
-q, --quiet | Squelch log messages to the console. |
-d, --debug | Turn on debug logging. |
-v, --verbose | Get more detailed output. |
* Learn more about how to create this file.
Flywheel Path Format
Use the fw:// prefix to specify Flywheel paths:
Examples
Copy from local to Flywheel
Copy from Flywheel to local
Copy between Flywheel containers
When to Use fw cp
- Copying a single file to or from Flywheel
- Moving files between Flywheel containers
- Quick file transfers without downloading entire containers
Comparison: fw cp vs. Other Commands
| Task | Use This Command |
|---|---|
| Copy single file | fw cp |
| Upload single file to container | fw upload (simpler syntax) |
| Download single file | fw cp or fw download |
| Download entire container | fw download |
| Upload many files | fw ingest |
The fw upload Command
Upload a single local file to a specific Flywheel container using fw upload.
Usage
Required Arguments
| Required Argument | Description |
|---|---|
local-file | Path to the local file to upload |
destination-path | Flywheel container path: group/project/subject/session/acquisition |
Optional Arguments
| Optional Argument | Description |
|---|---|
-h, --help | Show help message and exit. |
-C PATH, --config-file | Specify configuration options via config file.* |
--no-config | Do NOT load the default configuration file. |
-y, --yes | Assume the answer is yes to all prompts. |
--ca-certs CA_CERTS | Path to a local Certificate Authority certificate bundle file. This option may be required when using a private Certificate Authority. |
--timezone TIMEZONE | Set the effective local timezone to use when uploading data. |
-q, --quiet | Squelch log messages to the console. |
-d, --debug | Turn on debug logging. |
-v, --verbose | Get more detailed output. |
* Learn more about how to create this file.
Examples
Upload file to acquisition
Upload file to session
Upload file to project
Where Files Are Stored
Files uploaded to different container levels are stored in different locations:
- Project: Stored as project attachments
- Subject: Stored as subject attachments
- Session: Stored as session attachments
- Acquisition: Stored as acquisition files
When to Use fw upload
- Uploading a single file to an existing container
- Adding documentation or metadata files
- Quick uploads without complex folder structures
Note
For uploading multiple files or entire datasets, use fw ingest commands instead.
The fw download Command
Download files or entire containers from Flywheel to your local filesystem using fw download.
Usage
Required Arguments
| Required Argument | Description |
|---|---|
source-path | The Flywheel path to download (e.g., group/project/subject/session/acquisition or specific file path) |
Optional Arguments
Download Options
| Optional Argument | Description |
|---|---|
-i FILE_TYPE, --include FILE_TYPE | Download only files with the specified types.* |
-e FILE_TYPE, --exclude FILE_TYPE | Ignore files with the specified types.* |
-o, --output file name | Name of the folder where the data is downloaded |
-p PREFIX, --prefix PREFIX | Prefix for downloaded directory structure |
* Learn more about file types in Flywheel
General Options
| Optional Argument | Description |
|---|---|
-h, --help | Show help message and exit. |
-C PATH, --config-file | Specify configuration options via config file.* |
--no-config | Do NOT load the default configuration file. |
-y, --yes | Assume the answer is yes to all prompts. |
--ca-certs CA_CERTS | Path to a local Certificate Authority certificate bundle file. This option may be required when using a private Certificate Authority. |
--timezone TIMEZONE | Set the effective local timezone to use when uploading data. |
-q, --quiet | Squelch log messages to the console. |
-d, --debug | Turn on debug logging. |
-v, --verbose | Get more detailed output. |
* Learn more about how to create this file.
Examples
Download an entire subject
Output:
Download a specific session
Download a single acquisition
Download specific file types only
Download to specific output location
Download with custom prefix
This creates a directory structure like: MyStudy/AnxietyStudy/sub-001/...
Understanding Download Structure
When you download a container, fw download creates a .tar archive by default containing:
- All files in the container
- Metadata about the container
- The complete hierarchy below that container
To extract the downloaded archive:
When to Use fw download
- Downloading data for local analysis
- Creating backups of specific subjects or sessions
- Retrieving processed results from Flywheel
- Downloading specific file types from a container
Note
For exporting data in specific formats (like BIDS), use fw export bids instead.
Common Workflows
Explore and Download Data
Upload Analysis Results
Copy File Between Projects
Selective Download
Command Comparison
When to Use Each Command
| Task | Best Command | Why |
|---|---|---|
| Browse Flywheel hierarchy | fw ls | Quick navigation, see what's available |
| Copy single file to Flywheel | fw upload or fw cp | upload is simpler, cp supports fw:// syntax |
| Copy single file from Flywheel | fw cp or fw download | cp for single files, download for containers |
| Download entire container | fw download | Automatically creates archive with all files |
| Copy between Flywheel locations | fw cp | Direct copy without downloading first |
| Upload many files | fw ingest | See Ingest Commands |
| Download in BIDS format | fw export bids | See Export Commands |
Syntax Comparison
Common Errors
Common CLI Errors
For authentication, network issues, and other errors common to all CLI commands, see the CLI Troubleshooting Guide.
"Path not found"
Cause: The specified Flywheel path doesn't exist or you don't have access.
Solution:
- Use
fw lsto verify the path exists - Check spelling and capitalization (paths are case-sensitive)
- Verify you have permission to access the container
"Permission denied"
Cause: You don't have sufficient permissions for the operation.
Solution:
- Check your permission level with
fw ls - Contact your Flywheel site administrator to request access
- Verify you're logged in with
fw status
"File already exists"
Cause: When using fw upload or fw cp, a file with the same name already exists at the destination.
Solution:
- Rename your local file before uploading
- Delete the existing file in Flywheel first (if appropriate)
- Use a different destination path
"Connection timeout"
Cause: Large file transfers may timeout on slow connections.
Solution:
- For large files, use
fw ingestcommands which are optimized for bulk transfers - Check your network connection
- Try again during off-peak hours
Related Topics
- Ingest Commands - Import large datasets
- Export Commands - Export data in BIDS format
- Sync Command - Synchronize data to external storage
- CLI Configuration Files - Simplify complex commands
- File Types in Flywheel - Understanding file classifications