Ask Your Question
0

How to use wildcards with scp in Ruby for downloading files?

asked 2021-08-11 11:00:00 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-10-18 09:00:00 +0000

pufferfish gravatar image

To use wildcards with scp in Ruby for downloading files, you can pass the wildcard pattern as an argument to the scp command. For example, to download all files with the extension "txt" from a remote server to the local machine, you can use the following Ruby code:

system("scp user@remote:/path/*.txt /local/path/")

In this example, the "*".txt" wildcard pattern matches all files with the ".txt" extension in the remote directory specified by "/path/". The downloaded files are saved in the local directory specified by "/local/path/".

Note that you need to have valid SSH credentials for the remote server to use this command.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-08-11 11:00:00 +0000

Seen: 12 times

Last updated: Oct 18 '22