# 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)*.* |
