9

I want to transfer only files with special extensions (like only *.tar.gz, *.war) in one scp command (Debian Linux). Is this possible, if yes how is the syntax?

Should be someting like:

scp 192.168.1.2:/srv/myfiles/'*.tar.gz *.war' .

But this is not working.

markus
  • 1,080
  • 5
  • 18
  • 38

2 Answers2

11

This absolutely is possible

scp 192.168.1.2:/srv/myfiles/\{*.tar.gz,*.war\} .
GeoSword
  • 1,657
  • 12
  • 16
1
$ ssh 33 ls \{\*.log,\*.py\}
engine.log
install.log
parser_lex.py


$ scp 33:\{\*.log,\*.py\} /tmp/
engine.log                                                                                                                   100%   45     0.0KB/s   00:00    
install.log                                                                                                                  100%   18KB  18.0KB/s   00:00    
parser_lex.py                                                                                                                100% 2600     2.5KB/s   00:00  
jirib
  • 1,240
  • 8
  • 15
  • You can also use ssh and tar... – jirib Nov 15 '13 at 09:46
  • PS: You can learn how it works while creating a ForceCommand on remote host and check what is in SSH_ORIGINAL_COMMAND environment variable :) See https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works – jirib Nov 15 '13 at 09:51