# extract

## Overview

The tool extracts a copy of specified objects from a package and writes to a directory

## Example Usage

Extract subject `S1234` to `/path/to/outdir`

`squirrel extract <package> --object subject --objectid S1234 --outdir /path/to/outdir`

## Options

### --object

`--object <object>` can be one of the following

* package
* subject
* study
* series
* analysis
* intervention
* observation
* experiment
* pipeline
* groupanalysis
* datadictionary

### --outdir

`--outdir <outdir>` specifies a path to which the object(s) will be written. Filenames(s) will reflect the object IDs or names.

### --objectid

`--objectid <id>` specifies the ID or name of the object to extract. For example: subject with ID `S1234` or experiment named `MyExperiment`.

### --recurse

If specified, `--recurse` will extract all child objects of the specified object. If option is not set, only the specified object will be extracted.

### --subjectid

`--subjectid <id>` specifies the subject ID when extracting **study**, **series**, **intervention**, **observation**, or **analysis** objects.

### --studynum

`--studynum <num>` specifies the study number when extracting **series** and **analysis** objects. Must be used with `--subjectid` option.


---

# 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.neuroinfodb.org/squirrel/getting-started/squirrel-utilities/extract.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.
