I was connected my OpenSSH, but What's the command for ssh to find all files which are *.png and get them at the same time, recursively
I was connected my OpenSSH, but What's the command for ssh to find all files which are *.png and get them at the same time, recursively
You can list files of your interest with
ssh
, then download them withscp
:All
*.png
files under/remote_path
will be downloaded to/local_path
, but the remote directory structure will not be created (all files will be put in the same directory), so you may have problems if you have two files with the same name in different directories.Edit
The remote
find
command line should be corrected in this way:where the internal pair of single quotes are needed to avoid local shell pathname expansion of
*
, wheras the external pair of double quotes are needed to avoid remote shell pathname expansion of*
.The two types of quotes could be exchanges, and other syntaxes could be used, like
\''*.png'\'
,\""*.png"\"
or"\"*.png\""
.If you don't have .png in remote home directory, there is no difference between the two commands, but it is better to be safe.
The fastest way I know is to create tar.gz remotely, transfer it via SSH and untar locally:
This will work with filenames with spaces and is faster than
scp -r
and much faster thanscp
for each file.