Home > front end >  how to download file VIA wget while target path include Wildcards
how to download file VIA wget while target path include Wildcards

Time:11-30

here is elegant example how to download file and copy it to

/etc/yum.repo.d folder

example

REPOSITORY_SERVER=master_machine01
wget -nd -r -P /etc/yum.repos.d/  -A ".repo" "http://$REPOSITORY_SERVER/ambari/centos7/2.6.2.2-1/ambari.repo"

after above command ambari.repo file will copied to /etc/yum.repos.d/

note: the file amabri.rep path is

ls -ltr /var/www/html/ambari/centos7/2.6.2.2-1/ambari.repo
-rw-r--r-- 1 root users 304 Jun 11  2018 /var/www/html/ambari/centos7/2.6.2.2-1/ambari.repo

so this is the simple case

now what about path could be as ( with diff path's )

$REPOSITORY_SERVER/ambari/centos7/2.6.2.3-1/ambari.repo

or

$REPOSITORY_SERVER/ambari/centos7/2.6.2.2-4/ambari.repo

then how to use the cli with Wildcards

we try the following

wget -nd -r -P /etc/yum.repos.d/  -A ".repo" "http://$REPOSITORY_SERVER/ambari/centos7/*/ambari.repo"

but we get

HTTP request sent, awaiting response... 404 Not Found
2021-11-28 18:40:07 ERROR 404: Not Found.

or even with backslash

 wget -nd -r -P /etc/yum.repos.d/  -A ".repo" "http://$REPOSITORY_SERVER/ambari/centos7/\*/ambari.repo"

BUT WITH THE SAME ERROR

any idea how to resolve this issue?

CodePudding user response:

how to use the cli with Wildcards

It is not possible to perform a glob expansion with HTTP protocol. These are very unrelated technologies.

how to resolve this issue?

Devise and implement a method of getting the available files under certain path from an HTTP server. For example, contact the server administrator and ask him about it. Potentially, if the HTTP server supports serving a directory listing, recursively filter the listing to find all matching paths. Or find and query some other site that contains all the links and filter the obtained answer to extract all links, for example. Etc.

  • Related