Is it possible to GET or PUT two specific files at a time using SFTP without wildcard?
you can do:
sftp user@host << EOF!
get /path/to/file1
get /path/to/file2
EOF!
But personally I prefer to use scp
in such cases.
If possible, use lftp
as your sftp client (available for all the relevant Linux distros and *BSDs in their package collections):
lftp sftp://[email protected]
Then you can use mget
command:
mget javascript.gs stylesheet.css
If lftp
is not possible to use, then you can use -b
(batch) option in standard sftp
command. First create a text file containing
get javascript.gs
get stylesheet.css
And then use command
sftp -b yourtextfile.txt [email protected]
You can't do this with sftp, the syntax for get is get remote-path [local-path] which means that the second parameter if supplied will be used to rename the file on the local system. Similarly put would rename the uploaded file if a second parameter is supplied.
You could use scp to to the job
scp [email protected]:"/path/to/javascript.gs /path/to/stylesheet.css" /local/path
You could also use an sftp script.