# `jadpo files`

Read and copy stored files.

A store of files is a connection with `Driver.disk` or `Driver.s3` (area 16). `jadpo files` lists the app's stores. `ls` lists the files a store keeps with their sizes, the erasure log's among them. `show` reads one file through and says its size, the type its first bytes look like and its hash. `get` writes a file's bytes to a local file it never overwrites. `put` puts a local file back under a file's key that holds nothing yet, since files never change. `copy` copies every file and the erasure log from one store into another, leaving those already there, so it can be run again to catch up: how an app moves off one server. A store is reached as the deployed app reaches it: a disk store at its `path:`, an S3 store with the settings the environment, then `.env.local`, gives. --dev reaches jadpo dev's copy instead. `copy` also takes a disk store's folder written in full.

Also: `jadpo file`.

```text
jadpo files [action] [store] [key] [path]
```

## Arguments

- `action` (optional): What to do
- `store` (optional): The store, by its connection; copy's from
- `key` (optional): A file's key, as ls lists it; copy's to
- `path` (optional): The local file get writes or put reads

## Flags

- `--dev`: Reach jadpo dev's copy of the store

## On every command

- `--json`: Print data for tools instead of text
- `--full`: Show everything a report shortens
- `--help`: Show every flag, with examples
- `--color <when>`: Choose when to use colour

`jadpo files --json` writes one JSON document to standard output instead of text, with the same exit code. The document has `schemaVersion`, `command` (`"files"`), `ok`, `data` (what the command produced, `null` when it failed) and `diagnostics` (each error with its `rule`, `reason`, `next` and `help`). A command that needs a terminal refuses `--json` and names the flags that do the same job.

## Examples

```text
# See the app's stores of files
jadpo files
# List the files a store keeps
jadpo files ls uploads
# Save one file's bytes
jadpo files get uploads 3f/a2/3fa2c1d0-0000-4000-8000-000000000001 copy.csv
# Move a disk store's files into the bucket its connection now names
jadpo files copy /var/lib/acme/uploads uploads
```

## Errors

- [`cli.files_arguments`](/docs/errors/cli.files_arguments.md): A `jadpo files` command names an action it doesn't have, a store the app doesn't keep files in, a file the store doesn't hold, or a local file it can't use
- [`files.unavailable`](/docs/errors/files.unavailable.md): A store of files couldn't be reached, read or written by a `jadpo files` command, or its settings have no value here
- [`toolchain.project_not_found`](/docs/errors/toolchain.project_not_found.md): You ran a command that works on a project in a folder with no `app.jadpo`, in it or in any folder above it
