|
| 1 | +# list-url |
| 2 | + |
| 3 | +<admon type="info"> |
| 4 | + |
| 5 | +Aliased to `dvc ls-url` |
| 6 | + |
| 7 | +</admon> |
| 8 | + |
| 9 | +List contents from a supported URL (for example `s3://`, `ssh://`, and other |
| 10 | +protocols). |
| 11 | + |
| 12 | +<admon type="tip"> |
| 13 | + |
| 14 | +Useful to find data to `dvc get-url` or `dvc import-url`. |
| 15 | + |
| 16 | +</admon> |
| 17 | + |
| 18 | +## Synopsis |
| 19 | + |
| 20 | +```usage |
| 21 | +usage: dvc list-url [-h] [-q | -v] [-R] url |
| 22 | +
|
| 23 | +positional arguments: |
| 24 | + url (See supported URLs in the description) |
| 25 | +``` |
| 26 | + |
| 27 | +## Description |
| 28 | + |
| 29 | +Lists files and directories from an external location. `dvc list-url` provides a |
| 30 | +uniform interface to browse the contents of an external location using any |
| 31 | +protocol that is understood by `dvc get-url` or `dvc import-url`. For example, |
| 32 | +it is roughly equivalent to `aws s3 ls` when using the `s3://` protocol, or |
| 33 | +`ssh user@host ls -a` when using `ssh://`. |
| 34 | + |
| 35 | +The `url` argument specifies the location of the data to be listed. It supports |
| 36 | +several kinds of external data sources: |
| 37 | + |
| 38 | +| Type | Description | `url` format example | |
| 39 | +| ------- | ---------------------------- | ------------------------------------- | |
| 40 | +| `s3` | Amazon S3 | `s3://bucket/data` | |
| 41 | +| `azure` | Microsoft Azure Blob Storage | `azure://container/data` | |
| 42 | +| `gs` | Google Cloud Storage | `gs://bucket/data` | |
| 43 | +| `ssh` | SSH server | `ssh://[email protected]/path/to/data` | |
| 44 | +| `local` | Local path | `/path/to/local/data` | |
| 45 | + |
| 46 | +<admon type="info"> |
| 47 | + |
| 48 | +If you installed DVC via `pip` and plan to access cloud services as external |
| 49 | +data sources, you might need to install these optional dependencies: `[s3]`, |
| 50 | +`[azure]`, `[gs]`, `[oss]`, `[ssh]`. Alternatively, use `[all]` to include them |
| 51 | +all. The command should look like this: `pip install "dvc[s3]"`. (This example |
| 52 | +installs `boto3` library along with DVC to support S3 storage.) |
| 53 | + |
| 54 | +</admon> |
| 55 | + |
| 56 | +Only the root directory is listed by default, but the `-R` option can be used to |
| 57 | +list files recursively. |
| 58 | + |
| 59 | +## Options |
| 60 | + |
| 61 | +- `-R`, `--recursive` - recursively list files in all subdirectories. |
| 62 | + |
| 63 | +- `-h`, `--help` - prints the usage/help message, and exit. |
| 64 | + |
| 65 | +- `-q`, `--quiet` - do not write anything to standard output. Exit with 0 if no |
| 66 | + problems arise, otherwise a non-zero value. |
| 67 | + |
| 68 | +- `-v`, `--verbose` - displays detailed tracing information. |
| 69 | + |
| 70 | +## Example: Amazon S3 |
| 71 | + |
| 72 | +This command will list objects and common prefixes under the specified path: |
| 73 | + |
| 74 | +```dvc |
| 75 | +$ dvc list-url s3://bucket/path |
| 76 | +``` |
| 77 | + |
| 78 | +DVC expects that AWS CLI is already |
| 79 | +[configured](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html). |
| 80 | +DVC will use the AWS credentials file to access S3. |
| 81 | + |
| 82 | +## Example: SSH |
| 83 | + |
| 84 | +```dvc |
| 85 | +$ dvc list-url ssh://[email protected]/path/to/data |
| 86 | +``` |
| 87 | + |
| 88 | +Using default SSH credentials, the above command lists files and directories |
| 89 | +inside `data`. |
| 90 | + |
| 91 | +## Example: local file system |
| 92 | + |
| 93 | +```dvc |
| 94 | +$ dvc list-url /local/path/to/data |
| 95 | +``` |
| 96 | + |
| 97 | +The above command will list the `/local/path/to/data` directory. |
0 commit comments