Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.