Command (wget) to grab all files with rpm extension from repository websites

nmh picture nmh · Aug 18, 2016 · Viewed 10.1k times · Source

Background- I'm trying to manually install a repo to cobbler because reposync isn't working for some reason. I need to download all of the rpm packages from this page in order to do this:

http://yum.puppetlabs.com/el/7/products/x86_64/

I can only wget the packages at the moment if I type them all in individually which would be way to time consuming. How can I issue a command to download all the rpm packages to my external drive? I've tried this:

wget http://yum.puppetlabs.com/el/7/products/x86_64/*.rpm

Which hasn't worked.

The second part of my question is related to the rpm packages on this page:

http://www.mirrorservice.org/sites/download.fedora.redhat.com/pub/epel/7/x86_64/ 

As you can see, the packages are indexed within folders A-Z. How can I issue a command to grab all of the .rpm files from each of the folder (A-Z) on this page. I don't need to maintain the A-Z folder structure, I would like to have all the rpm's just in a flat folder on my hardrive.

Thanks

Answer

Ipor Sircer picture Ipor Sircer · Aug 18, 2016

rtfm

wget -A rpm -r -l 5 http://yum.puppetlabs.com/el/7/products/x86_64/
wget -A rpm -r -l 5 -nd http://www.mirrorservice.org/sites/download.fedora.redhat.com/pub/epel/7/x86_64/

(read the fine manual)