DNAnexus Documentation
APIDownloadsIndex of dx CommandsLegal
  • Overview
  • Getting Started
    • DNAnexus Essentials
    • Key Concepts
      • Projects
      • Organizations
      • Apps and Workflows
    • User Interface Quickstart
    • Command Line Quickstart
    • Developer Quickstart
    • Developer Tutorials
      • Bash
        • Bash Helpers
        • Distributed by Chr (sh)
        • Distributed by Region (sh)
        • SAMtools count
        • TensorBoard Example Web App
        • Git Dependency
        • Mkfifo and dx cat
        • Parallel by Region (sh)
        • Parallel xargs by Chr
        • Precompiled Binary
        • R Shiny Example Web App
      • Python
        • Dash Example Web App
        • Distributed by Region (py)
        • Parallel by Chr (py)
        • Parallel by Region (py)
        • Pysam
      • Web App(let) Tutorials
        • Dash Example Web App
        • TensorBoard Example Web App
      • Concurrent Computing Tutorials
        • Distributed
          • Distributed by Region (sh)
          • Distributed by Chr (sh)
          • Distributed by Region (py)
        • Parallel
          • Parallel by Chr (py)
          • Parallel by Region (py)
          • Parallel by Region (sh)
          • Parallel xargs by Chr
  • User
    • Login and Logout
    • Projects
      • Project Navigation
      • Path Resolution
    • Running Apps and Workflows
      • Running Apps and Applets
      • Running Workflows
      • Running Nextflow Pipelines
      • Running Batch Jobs
      • Monitoring Executions
      • Job Notifications
      • Job Lifecycle
      • Executions and Time Limits
      • Executions and Cost and Spending Limits
      • Smart Reuse (Job Reuse)
      • Apps and Workflows Glossary
      • Tools List
    • Cohort Browser
      • Chart Types
        • Row Chart
        • Histogram
        • Box Plot
        • List View
        • Grouped Box Plot
        • Stacked Row Chart
        • Scatter Plot
        • Kaplan-Meier Survival Curve
      • Locus Details Page
    • Using DXJupyterLab
      • DXJupyterLab Quickstart
      • Running DXJupyterLab
        • FreeSurfer in DXJupyterLab
      • Spark Cluster-Enabled DXJupyterLab
        • Exploring and Querying Datasets
      • Stata in DXJupyterLab
      • Running Older Versions of DXJupyterLab
      • DXJupyterLab Reference
    • Using Spark
      • Apollo Apps
      • Connect to Thrift
      • Example Applications
        • CSV Loader
        • SQL Runner
        • VCF Loader
      • VCF Preprocessing
    • Environment Variables
    • Objects
      • Describing Data Objects
      • Searching Data Objects
      • Visualizing Data
      • Filtering Objects and Jobs
      • Archiving Files
      • Relational Database Clusters
      • Symlinks
      • Uploading and Downloading Files
        • Small File Sets
          • dx upload
          • dx download
        • Batch
          • Upload Agent
          • Download Agent
    • Platform IDs
    • Organization Member Guide
    • Index of dx commands
  • Developer
    • Developing Portable Pipelines
      • dxCompiler
    • Cloud Workstation
    • Apps
      • Introduction to Building Apps
      • App Build Process
      • Advanced Applet Tutorial
      • Bash Apps
      • Python Apps
      • Spark Apps
        • Table Exporter
        • DX Spark Submit Utility
      • HTTPS Apps
        • Isolated Browsing for HTTPS Apps
      • Transitioning from Applets to Apps
      • Third Party and Community Apps
        • Community App Guidelines
        • Third Party App Style Guide
        • Third Party App Publishing Checklist
      • App Metadata
      • App Permissions
      • App Execution Environment
        • Connecting to Jobs
      • Dependency Management
        • Asset Build Process
        • Docker Images
        • Python package installation in Ubuntu 24.04 AEE
      • Job Identity Tokens for Access to Clouds and Third-Party Services
      • Enabling Web Application Users to Log In with DNAnexus Credentials
      • Types of Errors
    • Workflows
      • Importing Workflows
      • Introduction to Building Workflows
      • Building and Running Workflows
      • Workflow Build Process
      • Versioning and Publishing Global Workflows
      • Workflow Metadata
    • Ingesting Data
      • Molecular Expression Assay Loader
        • Common Errors
        • Example Usage
        • Example Input
      • Data Model Loader
        • Data Ingestion Key Steps
        • Ingestion Data Types
        • Data Files Used by the Data Model Loader
        • Troubleshooting
      • Dataset Extender
        • Using Dataset Extender
    • Dataset Management
      • Rebase Cohorts and Dashboards
      • Assay Dataset Merger
      • Clinical Dataset Merger
    • Apollo Datasets
      • Dataset Versions
      • Cohorts
    • Creating Custom Viewers
    • Client Libraries
      • Support for Python 3
    • Walkthroughs
      • Creating a Mixed Phenotypic Assay Dataset
      • Guide for Ingesting a Simple Four Table Dataset
    • DNAnexus API
      • Entity IDs
      • Protocols
      • Authentication
      • Regions
      • Nonces
      • Users
      • Organizations
      • OIDC Clients
      • Data Containers
        • Folders and Deletion
        • Cloning
        • Project API Methods
        • Project Permissions and Sharing
      • Data Object Lifecycle
        • Types
        • Object Details
        • Visibility
      • Data Object Metadata
        • Name
        • Properties
        • Tags
      • Data Object Classes
        • Records
        • Files
        • Databases
        • Drives
        • DBClusters
      • Running Analyses
        • I/O and Run Specifications
        • Instance Types
        • Job Input and Output
        • Applets and Entry Points
        • Apps
        • Workflows and Analyses
        • Global Workflows
        • Containers for Execution
      • Search
      • System Methods
      • Directory of API Methods
      • DNAnexus Service Limits
  • Administrator
    • Billing
    • Org Management
    • Single Sign-On
    • Audit Trail
    • Integrating with External Services
    • Portal Setup
    • GxP
      • Controlled Tool Access (allowed executables)
  • Science Corner
    • Scientific Guides
      • Somatic Small Variant and CNV Discovery Workflow Walkthrough
      • SAIGE GWAS Walkthrough
      • LocusZoom DNAnexus App
      • Human Reference Genomes
    • Using Hail to Analyze Genomic Data
    • Open-Source Tools by DNAnexus Scientists
    • Using IGV Locally with DNAnexus
  • Downloads
  • FAQs
    • EOL Documentation
      • Python 3 Support and Python 2 End of Life (EOL)
    • Automating Analysis Workflow
    • Backups of Customer Data
    • Developing Apps and Applets
    • Importing Data
    • Platform Uptime
    • Legal and Compliance
    • Sharing and Collaboration
    • Product Version Numbering
  • Release Notes
  • Technical Support
  • Legal
Powered by GitBook

Copyright 2025 DNAnexus

On this page
  • Downloading a Single File
  • Downloading Using a File ID
  • Downloading Using a Filename
  • Downloading Using a File Path
  • Downloading Multiple Files
  • Downloading a Folder
  • Generating Download URLs
  • Generating a Single URL
  • Generating Multiple URLs
  • URL Expiration Dates
  • Advanced Options
  • Resuming Downloads
  • Redirecting Downloaded Files
  • Additional information

Was this helpful?

Export as PDF
  1. User
  2. Objects
  3. Uploading and Downloading Files
  4. Small File Sets

dx download

Learn how to use the dx download command to download data and share files among collaborators.

Last updated 2 years ago

Was this helpful?

Downloading a Single File

The command can download a file using either its file ID or its name. Files will be downloaded into the current local directory and will inherit their names from the platform unless specified otherwise.

Downloading Using a File ID

Using dx download to download a file using its ID is particularly useful in situations where there may be different files with the same name in the same folder. To get a file's ID via the web UI, select the file and click "Info". There will be a field labeled "ID" with a corresponding file ID of the format file-xxxx.

$ dx download file-xxxx
[                                                            ] Downloaded 0 byte
[===========================================================>] Downloaded 1,582,
[===========================================================>] Completed 1,582,904 of 1,582,904 bytes (100%) example.bam

INFO: You can remove the progress bar using the flag --no-progress. There will be no feedback after executing the command dx download. This is useful for scripting.

Downloading Using a Filename

Using dx download to download a file using its name differs slightly based on whether or not the filename is unique within its folder. To find your current working directory within DNAnexus, use the command to list the files in a directory, use the command .

Unique Filename

If the filename is unique within its folder, downloading a file using its name will look very similar to downloading a file using its ID.

$ dx download "different.bam"
[                                                            ] Downloaded 0 byte
[===========================================================>] Downloaded 1,582,
[===========================================================>] Completed 1,582,904 of 1,582,904 bytes (100%) different.bam

Non-Unique Filename

If a filename is not unique within its folder, upon executing dx download you will be prompted to select which file you intend on downloading.

If you use the -a/--all flag, all files will be downloaded. However, your local operating system may not allow multiple files of the same name to be in the same folder.

$ dx download "same.bam"
The given path "same.bam" resolves to the following data objects:
0) closed  2017-01-01 09:00:00 1.51 MB   same.bam (file-xxxx)
1) closed  2017-01-02 09:00:00 1.64 MB   same.bam (file-yyyy)

Pick a numbered choice: 0
[                                                            ] Downloaded 0 byte
[===========================================================>] Downloaded 1,582,
[===========================================================>] Completed 1,582,904 of 1,582,904 bytes (100%) same.bam

Downloading Using a File Path

If the file is contained within a folder, dx download can also use file paths as input. For example, if file file_name is contained within the folder my_folder/ in the project project-xxxx, the command changes accordingly. Projects can be identified by either their name or ID; if multiple projects are named identically, you will be prompted to select one.

$ dx download "project-xxxx:/my_folder/example.bam"
[                                                            ] Downloaded 0 byte
[===========================================================>] Downloaded 1,582,
[===========================================================>] Completed 1,582,904 of 1,582,904 bytes (100%) example.bam

$ dx download "Project_Name:/my_folder/example.bam"
[                                                            ] Downloaded 0 byte
[===========================================================>] Downloaded 1,582,
[===========================================================>] Completed 1,582,904 of 1,582,904 bytes (100%) example.bam

Downloading Multiple Files

If you only want to download a few files at once, you can use multiple filenames or file IDs as inputs to dx download.

$ dx download "example_1.bam" "example_2.bam" "project-xxxx:file-xxxx"
The given path "example_1.bam" resolves to the following data objects:
0) closed  2017-01-01 09:00:00 1.51 MB   example_1.bam (file-xxxx)
1) closed  2017-01-02 09:00:00 1.64 MB   example_1.bam (file-yyyy)

Pick a numbered choice: 0
[                                                            ] Downloaded 0 byte
[===========================================================>] Downloaded 1,582,
[===========================================================>] Completed 1,582,904 of 1,582,904 bytes (100%) example_1.bam
[                                                            ] Downloaded 0 byte
[===========================================================>] Downloaded 1,582,
[===========================================================>] Completed 1,582,904 of 1,582,904 bytes (100%) example_2.bam
[                                                            ] Downloaded 0 byte
[===========================================================>] Downloaded 1,582,
[===========================================================>] Completed 1,582,904 of 1,582,904 bytes (100%) example_3.bam

Downloading a Folder

If you want to download multiple files at once using dx download, moving desired files to a single folder can be the simplest solution. The -r/--recursive flag is required to download folders.

INFO: By default, if multiple files of the same name exist in a folder, only one of the files will be downloaded. Add the -a/--all flag to download all files, even if their names match. Please note that your local operating system may not allow multiple files of the same name to be in the same folder.

$ dx ls "example_folder/"
example_1.bam
example_2.bam
example_3.bam
$ dx download "example_folder" -r
$ ls "example_folder/"
example_1.bam  example_2.bam    example_3.bam

Generating Download URLs

Download URLs are useful for sharing files with collaborators who may or may not have accounts on DNAnexus. URLs may be pasted directly into a browser window for automatic download or used as input for the bash command wget.

Generating a Single URL

The command can be used on both file names and file IDs. The path to the file should include the project context, such as project-xxxx:file-yyyy, or project-xxxx:/path/to/file.txt.

$ dx make_download_url "project-xxxx:example.bam"
https://dl.dnanex.us/F/D/xxxx/example.bam
$ dx make_download_url project-xxxx:file-yyyy
https://dl.dnanex.us/F/D/xxxx/example.bam

As shown above, if the file name used as input is not unique within its folder, you will be prompted to select a file.

$ dx make_download_url "project-xxxx:example.bam"
The given path "example.bam" resolves to the following data objects:
0) closed  2017-01-01 09:00:00 1.51 MB   example.bam (file-xxxx)
1) closed  2017-01-02 09:00:00 1.64 MB   example.bam (file-yyyy)

Pick a numbered choice: 0
https://dl.dnanex.us/F/D/xxxx/example.bam

Generating Multiple URLs

You must write a script in order to generate download URLs for multiple files.

URL Expiration Dates

By default, URLs expire after one day. However, you can change the duration so that the URL lasts for a longer or shorter period of time.

$ dx make_download_url "project-xxxx:test.bam" --duration 1h
https://dl.dnanex.us/F/D/xxxx/test.bam

After the specified duration of time, downloading the file using the URL will no longer work. This is useful for restricting access to files.

Advanced Options

Resuming Downloads

If a file has only been partially downloaded, the -f/--overwrite flag will resume the download. However, if a file has been completely downloaded, the -f/--overwrite flag will overwrite the downloaded file.

Redirecting Downloaded Files

By default, files will assume the same name they had on the platform when downloaded. However, you can override this with the -o/--output flag. This is useful if your script assumes a specific file name.

$ dx download "example.bam" -o "not_example.bam"
[                                                            ] Downloaded 0 byte
[===========================================================>] Downloaded 1,582,
[===========================================================>] Completed 1,582,904 of 1,582,904 bytes (100%) not_example.bam

Redirecting to a Different Folder

You may also redirect the outputs to a different folder using the -o/--output flag. Please note that if you are redirecting the outputs to a different folder, dx download will not create the folders; they must already exist before downloading the files.

$ dx download "example.bam" -o "newdir/not_example.bam"
[                                                            ] Downloaded 0 byte
[===========================================================>] Downloaded 1,582,
[===========================================================>] Completed 1,582,904 of 1,582,904 bytes (100%) newdir/not_example.bam

Printing to stdout

The command dx download file-xxxx -o - will redirect the contents of the file file-xxxx to stdout. This has the same functionality as the command dx cat file-xxxx.

$ dx download "sample.txt" -o -
This is a sample text file.

Additional information

The command is used to generate download URLs.

Executing the dx download --help command will show all of the flags available to use in conjunction with dx download. The message printed by this command is identical to the one displayed in the brief description of . More information about can be found on the same page and by running the command dx make_download_url --help.

dx download
dx pwd
dx ls
dx make_download_url
dx download
dx make_download_url