dx download
Learn how to use the dx download command to download data and share files among collaborators.
Last updated
Was this helpful?
Learn how to use the dx download command to download data and share files among collaborators.
Last updated
Was this helpful?
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.
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.
INFO: You can remove the progress bar using the flag
--no-progress
. There will be no feedback after executing the commanddx download
. This is useful for scripting.
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 .
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.
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 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.
If you only want to download a few files at once, you can use multiple filenames or file IDs as inputs to dx download
.
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.
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
.
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
.
As shown above, if the file name used as input is not unique within its folder, you will be prompted to select a file.
You must write a script in order to generate download URLs for multiple files.
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.
After the specified duration of time, downloading the file using the URL will no longer work. This is useful for restricting access to files.
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.
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.
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.
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
.
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
.