I have the following files in a remote machine:

└── selenoid
    ├── browsers.json
    ├── run.sh
    └── Logger.java

I want to copy run.sh and browsers.json from the remote machine to my local machine. I know how to copy a single file from the remote machine:

scp user@ .

But how can I copy both browsers.json and run.sh from the remote machine?


You can do this:

scp 'user@{browsers.json,run.sh}' .

You need the quotes so that expansion takes place on the remote side. Without it, it will work, but you might have to enter the credentials twice.

  • This would likely require that the remote user's login shell understands brace expansions. – Kusalananda Nov 28 '19 at 15:04

Try this:

scp -T user@"/home/aerokube/selenoid/browsers.json /home/aerokube/selenoid/run.sh" .
  • In some cases -T might not work, so try with and without it.
  • I am getting this message: protocol error: filename does not match request – Prasanth Ganesan Nov 28 '19 at 15:23
  • Worked after adding the -T flag! – Prasanth Ganesan Nov 29 '19 at 5:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.