1

From a remote directory I have to automatically download a file of which I know part of the name, only (e.g. "file-vers.1.2.3.zip", where the version number is the unknown part).

Since neither wget nor curl accept the '*' special character in the paths, I suppose I need to download the directory contents first (the equivalent of ls or dir), parse it, extract the file name I need, check its version is newer that what I already have, and pass it to either wget or curl.

If there is no quicker way that this, my question is: how can I download the directory contents from an HTTPS and an SFTP repository?

Pietro
  • 1,861

1 Answers1

2

In case of SFTP you can use ls to get the listing. But will be much easier to use command mget:

mget file-vers*.zip

This command will get all the files based on the wildcard.

Romeo Ninov
  • 7,848