# How to archive and retrieve data in BaseSpace using BaseSpace Command Line Interface (CLI) commands?

**Archiving runs and datasets**

Use the `archive` command to send data to long-term storage:

```
`$ bs archive run -i <Run ID>$ bs archive dataset -i <Dataset ID>`  
```

Use the `IsArchived` field to check whether runs or datasets have been archived:

```
`# show all archived runs$ bs list runs --filter-field IsArchived --filter-term true`  
```

Similar to deletion, archival will only move the `Data/` directory of run files, while InterOp and other metadata will remain accessible. For datasets, all files will be archived but metadata including any dataset attributes will remain available.

### **Restoring data from the archive**

To regain access to archived data, use the `unarchive` command:

```
`$ bs unarchive run -i 123456$ bs unarchive dataset -i ds.123`  
```

Note that the restore process can take up to several days to complete. The `IsArchived` field will remain `true` until the data has been fully restored.

### **Bulk archival**

As with other CLI commands, it it easy to combine `archive` with the `list` command for powerful results:

```
# archive all runs which are over a year old$ bs list runs --older-than 1y --terse | xargs -n1 bs archive run -i# archive all datasets in a given project$ bs list datasets --project-id 123456 --terse | xargs -n1 bs archive dataset -i  
```

\
\
\ <br>

|                                                                                                                                                                                                                                                                                                                                                                 |
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| *For any feedback or questions regarding this article (Illumina Knowledge Article #5447), contact Illumina Technical Support* [*techsupport@illumina.com*](mailto:techsupport@illumina.com?subject=Question%2FFeedback%20Regarding%20Illumina%20Knowledge%20Article%20#000005447%20-%20Software%20\&body=Dear%20Illumina%20Technical%20Support,%0D%0A%0D%0A)*.* |


---

# 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://knowledge.illumina.com/software/cloud-software/software-cloud-software-faq-list/000005447.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.
