👨‍💻 Using scp with ohmyzsh

February 19, 2022

Wildcard Copies

This trips me up every time I attempt to copy files from a RaspberryPi to my MacBook.

When using a zsh shell, you must escape wildcard characters.

Good

correct — escaped wildcard
$ scp [email protected]:/home/some/dir/\* ./data/

Bad

incorrect — unescaped wildcard
$ scp [email protected]:/home/some/dir/* ./data/
TIL
In zsh, you must escape wildcard characters in scp commands with a backslash — scp host:/path/\*.txt . — or the shell tries to glob locally.

Source

Credit goes to this stack overflow response that I have stumbled towards dozens of times.