# storage

Storage operations

## Usage

```bash
apolo storage [OPTIONS] COMMAND [ARGS]...
```

Storage operations.

**Commands:**

| Usage             | Description                          |
| ----------------- | ------------------------------------ |
| [*cp*](#cp)       | Copy files and directories           |
| [*df*](#df)       | Show current storage usage           |
| [*glob*](#glob)   | List resources that match PATTERNS   |
| [*ls*](#ls)       | List directory contents              |
| [*mkdir*](#mkdir) | Make directories                     |
| [*mv*](#mv)       | Move or rename files and directories |
| [*rm*](#rm)       | Remove files or directories          |
| [*tree*](#tree)   | List storage in a tree-like format   |

### cp

Copy files and directories

#### Usage

```bash
apolo storage cp [OPTIONS] [SOURCES]... [DESTINATION]
```

Copy files and directories.

Either `SOURCES` or `DESTINATION` should have storage:// scheme. If scheme is omitted, file:// scheme is assumed.

Use /dev/stdin and /dev/stdout file names to copy a file from terminal and print the content of file on the storage to console.

Any number of --exclude and --include options can be passed. The filters that appear later in the command take precedence over filters that appear earlier in the command. If neither --exclude nor --include options are specified the default can be changed using the storage.cp-exclude configuration variable documented in "apolo help user- config".

#### Examples

```bash

# copy local files into remote storage root
$ apolo cp foo.txt bar/baz.dat storage:
$ apolo cp foo.txt bar/baz.dat -t storage:

# copy local directory `foo` into existing remote directory `bar`
$ apolo cp -r foo -t storage:bar

# copy the content of local directory `foo` into existing remote
# directory `bar`
$ apolo cp -r -T storage:foo storage:bar

# download remote file `foo.txt` into local file `/tmp/foo.txt` with
# explicit file:// scheme set
$ apolo cp storage:foo.txt file:///tmp/foo.txt
$ apolo cp -T storage:foo.txt file:///tmp/foo.txt
$ apolo cp storage:foo.txt file:///tmp
$ apolo cp storage:foo.txt -t file:///tmp

# download other project's remote file into the current directory
$ apolo cp storage:/{project}/foo.txt .

# download only files with extension `.out` into the current directory
$ apolo cp storage:results/*.out .
```

#### Options

| Name                                 | Description                                                                                                                                                                                                                               |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *--help*                             | Show this message and exit.                                                                                                                                                                                                               |
| *--continue*                         | Continue copying partially-copied files.                                                                                                                                                                                                  |
| *--exclude-from-files FILES*         | A list of file names that contain patterns for exclusion files and directories. Used only for uploading. The default can be changed using the storage.cp-exclude-from-files configuration variable documented in "apolo help user-config" |
| *--exclude TEXT*                     | Exclude files and directories that match the specified pattern.                                                                                                                                                                           |
| *--include TEXT*                     | Don't exclude files and directories that match the specified pattern.                                                                                                                                                                     |
| *--glob / --no-glob*                 | Expand glob patterns in SOURCES with explicit scheme. *\[default: glob]*                                                                                                                                                                  |
| *-T, --no-target-directory*          | Treat DESTINATION as a normal file.                                                                                                                                                                                                       |
| *-p, --progress / -P, --no-progress* | Show progress, on by default in TTY mode, off otherwise.                                                                                                                                                                                  |
| *-r, --recursive*                    | Recursive copy, off by default                                                                                                                                                                                                            |
| *-t, --target-directory DIRECTORY*   | Copy all SOURCES into DIRECTORY.                                                                                                                                                                                                          |
| *-u, --update*                       | Copy only when the SOURCE file is newer than the destination file or when the destination file is missing.                                                                                                                                |

### df

Show current storage usage

#### Usage

```bash
apolo storage df [OPTIONS] [PATH]
```

Show current storage usage.

If `PATH` is specified, show storage usage of which path is a part.

#### Options

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### glob

List resources that match PATTERNS

#### Usage

```bash
apolo storage glob [OPTIONS] [PATTERNS]...
```

List resources that match `PATTERNS`.

#### Options

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### ls

List directory contents

#### Usage

```bash
apolo storage ls [OPTIONS] [PATHS]...
```

List directory contents.

By default `PATH` is equal project's dir (storage:)

#### Options

| Name                             | Description                                          |
| -------------------------------- | ---------------------------------------------------- |
| *--help*                         | Show this message and exit.                          |
| *-d, --directory*                | list directories themselves, not their contents.     |
| *-l*                             | use a long listing format.                           |
| *-h, --human-readable*           | with -l print human readable sizes (e.g., 2K, 540M). |
| *-a, --all*                      | do not ignore entries starting with .                |
| *--sort \[name \| size \| time]* | sort by given field, default is name.                |

### mkdir

Make directories

#### Usage

```bash
apolo storage mkdir [OPTIONS] PATHS...
```

Make directories.

#### Options

| Name            | Description                                             |
| --------------- | ------------------------------------------------------- |
| *--help*        | Show this message and exit.                             |
| *-p, --parents* | No error if existing, make parent directories as needed |

### mv

Move or rename files and directories

#### Usage

```bash
apolo storage mv [OPTIONS] [SOURCES]... [DESTINATION]
```

Move or rename files and directories.

`SOURCE` must contain path to the file or directory existing on the storage, and `DESTINATION` must contain the full path to the target file or directory.

#### Examples

```bash

# move and rename remote file
$ apolo mv storage:foo.txt storage:bar/baz.dat
$ apolo mv -T storage:foo.txt storage:bar/baz.dat

# move remote files into existing remote directory
$ apolo mv storage:foo.txt storage:bar/baz.dat storage:dst
$ apolo mv storage:foo.txt storage:bar/baz.dat -t storage:dst

# move the content of remote directory into other existing
# remote directory
$ apolo mv -T storage:foo storage:bar

# move remote file into other project's directory
$ apolo mv storage:foo.txt storage:/{project}/bar.dat

# move remote file from other project's directory
$ apolo mv storage:/{project}/foo.txt storage:bar.dat
```

#### Options

| Name                               | Description                                        |
| ---------------------------------- | -------------------------------------------------- |
| *--help*                           | Show this message and exit.                        |
| *--glob / --no-glob*               | Expand glob patterns in SOURCES *\[default: glob]* |
| *-T, --no-target-directory*        | Treat DESTINATION as a normal file                 |
| *-t, --target-directory DIRECTORY* | Copy all SOURCES into DIRECTORY                    |

### rm

Remove files or directories

#### Usage

```bash
apolo storage rm [OPTIONS] PATHS...
```

Remove files or directories.

#### Examples

```bash

$ apolo rm storage:foo/bar
$ apolo rm storage:/{project}/foo/bar
$ apolo rm storage://{cluster}/{project}/foo/bar
$ apolo rm --recursive storage:/{project}/foo/
$ apolo rm storage:foo/**/*.tmp
```

#### Options

| Name                                 | Description                                              |
| ------------------------------------ | -------------------------------------------------------- |
| *--help*                             | Show this message and exit.                              |
| *--glob / --no-glob*                 | Expand glob patterns in PATHS *\[default: glob]*         |
| *-p, --progress / -P, --no-progress* | Show progress, on by default in TTY mode, off otherwise. |
| *-r, --recursive*                    | remove directories and their contents recursively        |

### tree

List storage in a tree-like format

#### Usage

```bash
apolo storage tree [OPTIONS] [PATH]
```

List storage in a tree-like format

Tree is a recursive directory listing program that produces a depth indented listing of files, which is colorized ala dircolors if the LS\_`COLORS` environment variable is set and output is to tty. With no arguments, tree lists the files in the storage: directory. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn. Upon completion of listing all files/directories found, tree returns the total number of files and/or directories listed.

By default `PATH` is equal project's dir (storage:)

#### Options

| Name                             | Description                                  |
| -------------------------------- | -------------------------------------------- |
| *--help*                         | Show this message and exit.                  |
| *-h, --human-readable*           | Print the size in a more human readable way. |
| *-a, --all*                      | do not ignore entries starting with .        |
| *-s, --size*                     | Print the size in bytes of each file.        |
| *--sort \[name \| size \| time]* | sort by given field, default is name         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.apolo.us/index/apolo-cli/commands/storage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
