Last active
June 11, 2019 01:06
-
-
Save thorr18/71bcaf8ae1f23f9ce84eea19e2dbf6ed to your computer and use it in GitHub Desktop.
Copy with scp can be weird
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SCP is kinda weird. | |
To copy all files in 3 levels of nested directories ending in foo.bar, such as 123foo.bar & 456foo.bar: | |
scp USER@SERVER:'/path/to/some\ directory/*/*/*foo.bar' ./ | |
Notice the directory name has a space in it so we escape with a backslash. | |
An alternative to the escape character would be double quotes within the single quotes, around the non wild part of the source path: | |
scp USER@SERVER:'"/path/to/some directory"/*/*/*foo.bar' ./ | |
The destination of ./ means local directory. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SCP is kinda weird.
To copy all files in 3 levels of nested directories ending in foo.bar, such as 123foo.bar & 456foo.bar:
scp USER@SERVER:'/path/to/some\ directory/*/*/*foo.bar' ./
Notice the directory name has a space in it so we escape with a backslash.
An alternative to the escape character would be double quotes within the single quotes, around the non wild part of the source path:
scp USER@SERVER:'"/path/to/some directory"/*/*/*foo.bar' ./
The destination of ./ means local directory.