# scp

von lokal zu Remote:

```
scp -r /mnt/d/Entwicklung/Praxis\ L/network_str_53_HH_v8.1.127.unf root@pl-mini-02-fbs.nb.pl:/root/
```

zwischen zwei Remotes:

```
scp -3 -p -r root@10.1.1.71:/var/lib/docker/volumes/kimai2_mysql-data root@fn-02.MEINEDOMAIN.it:/mnt/fn-volume-02/docker-data/volumes/kimai_mysql-data/
```

&gt; Das `-3` Flag leitet den Datentransfer über dein lokales System, was hilfreich ist, wenn die beiden Hosts sich nicht direkt erreichen können.

Die `-p` Option bewahrt:

- Modification times (mtime)
- Access times (atime)
- File modes (Berechtigungen)

[https://docs.rackspace.com/docs/copy-files-with-scp-and-rsync](https://docs.rackspace.com/docs/copy-files-with-scp-and-rsync)

<div class="heading-text" id="bkmrk-ssh-and-scp-examples">SSH and SCP examples</div>Copy a file from a remote server:

```
~$ scp user@IP.address:/path/file_name /local/destination/path/
```

Copy a directory from a remote server:

```
~$ scp -r user@IP.address:/path/directory[/] /local/destination/path/
```

Copy a file to a remote server:

```
~$ scp /local/path/file_name user@IP.address:/destination/path/
```

<div class="CodeTabs CodeTabs_initial theme-light" id="bkmrk-copy-a-directory-to-"><div class="CodeTabs-inner" role="tabpanel"><div class="cm-s-neo" data-testid="SyntaxHighlighter">Copy a directory to a remote server:</div></div></div>```
~$ scp -r /local/path/directory[/] user@IP.address:/destination/path/
```