I would like to download all of the *.Rmd files in a github repository.
For a simple example, say I wanted to use R or an Rmd file to download all of the *.Rmd files in this repo:
https://github.com/maelle/rmd-blogging-course
I tried using a bash
chunk in my Rmd file and wget
, but wasn't able to get the Rmd files:
#\```{bash}
wget -r -k --accept *.Rmd https://github.com/maelle/rmd-blogging-course
#\```
I've seen this previous question on how to download an entire repo, but I'm after only the files of a certain extension.
You should use Git to clone the repository, or if you only need one revision, you can download a tarball or a zip file, the latter of which you can access from the button that says “Code”. As far as just downloading the *.Rmd
files, GitHub doesn't provide a way to recursively download a large amount of files without cloning or downloading a tarball or zip file.
While there are raw file endpoints, they won't work with wget --recursive
because there are no directories. Trying to do so anyway would likely cause you to get rate-limited and possibly flagged, since those endpoints aren't intended for bulk download. A tarball or zip file will also likely be much faster as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.