---
title: "Copying a File to Multiple Locations"
canonical: "https://kb.uconn.edu/space/IKB/10744071197/Copying%20a%20File%20to%20Multiple%20Locations"
format: markdown
---
The following information is useful for creating a backup.

## Code

To copy a file to multiple locations, use the following code:

##### **Multiple Copies**

```shell
xargs -n 1 cp -v foo.txt<<<"/tmp1/ /tmp2/ /tmp3/"
```

This code means that you are copying one file named `foo.txt` to multiple directories called `/tmp1/`, `/tmp2/`, and `/tmp3/` using the `xargs` command. 

The `xargs` command constructs argument list(s) and executes utilities like `cp`.

## Related Articles

> Macro (contentbylabel)

> Macro (details)