# copy command

The copy command copies items to an
output device, to another item-ID, or to another file.

## Syntax

```
copy file.reference itemlist*{(options)}
to: {(file.reference} {itemlist}
```

## Parameter(s)

| file.reference | Specifies the origination file from which information is being copied and/or the destination file to which information is being copied. | |
| --- | --- | --- |
| itemlist | Specifies the list of items. | |
| options | n | Integer number that specifies the number of items to copy. Typically used for copying data for test files. |
| a | Activates assembly mlist format. | |
| d | Deletes original source item after copying. Not valid with the t or p option. | |
| f | Outputs a form feed between each item; only valid with the t and p option. | |
| i | Suppresses display of item-IDs when copying between files. | |
| m | Activates macro (assembly) format on terminal or printer output only. | |
| n | Activates nopage function on output to the terminal; only available with the t option. | |
| o | Overwrites existing items when duplicate item-IDs exist; has no effect if used with t or p option. | |
| p | Directs output to system printer, via the spooler. | |
| s | Suppresses display of line (attribute) numbers when used with the t or p option. | |
| s | Suppresses error message display when copying between files. | |
| t | Directs output to the terminal. | |
| u | If the item-ID is in the destination file, the item is copied to a new item-ID by creating a new item-ID composed of the original item-ID concatenated with a letter, starting with a lowercase a. | |
| x | Outputs in hexadecimal; only available with the t and p option. | |
If an output device is not specified in the options (either
to the terminal or printer), the prompt to: displays
on the next line.

If copying to another file, a left parenthesis
must precede the file name. A closing right parenthesis is not needed.
If the file reference is not specified at the to: prompt,
the items are copied to the source file.

If no item list is included, the items in the destination file are given the same item-IDs as the
 items in the source file. The absence of an item list or the use of "*" (asterisk) for the item
 list indicates that all source file items are to be copied.

The file reference can refer to a dictionary level by preceding the file reference with the word,
 `DICT`, followed by a space. No item list is required when the
 copy follows a select, sselect,
 get-list, or qselect (or any other list-generating
 process).

File-defining items
are *protected* and cannot be copied with the copy command.

## Example(s)

```
copy dict invoices customer.name (p
copy invoices * (od
to: (invoices,archive
```

```
copy dict invoices size
to: (dict sales
```

## See also

- [copy-list command](https://d3codex.com/tcl/copy-list-command/)
- [cp command](https://d3codex.com/tcl/cp-command/)
- [ct command](https://d3codex.com/tcl/ct-command/)
- [delete command](https://d3codex.com/tcl/delete-command/)
- [export command](https://d3codex.com/tcl/export-command/)
- [get-list command](https://d3codex.com/tcl/get-list-command/)
- [Header files](https://d3codex.com/definitions/header-files/)
- [list-item command (Access Query Language)](https://d3codex.com/access/list-item-command-access-query-language/)
- [move-file command](https://d3codex.com/tcl/move-file-command/)
- [qselect command](https://d3codex.com/tcl/qselect-command/)
- [rename command](https://d3codex.com/tcl/rename-command/)
- [rename-file command](https://d3codex.com/tcl/rename-file-command/)
- [nselect command](https://d3codex.com/access/nselect-command/)
- [sselect command](https://d3codex.com/access/sselect-command/)
- [steal-file command](https://d3codex.com/tcl/steal-file-command/)
- [wincopy command](https://d3codex.com/tcl/wincopy-command/)

---
Source: https://d3codex.com/tcl/copy-command/ - part of the D3Codex reference.
