How to get list files from a github repository folder using R

Marcin Kosiński

I am wondering if there exists a function or a link or any method that would work like list.files() function in R but on a folder stored on a github repostiory.

example github repository folder: https://github.com/KZPS/Spotkania/tree/master/Matteo/literature

Thanks for any advice !

lukeA

Here's one way:

library(httr)
req <- GET("https://api.github.com/repos/KZPS/Spotkania/git/trees/master?recursive=1")
stop_for_status(req)
filelist <- unlist(lapply(content(req)$tree, "[", "path"), use.names = F)
grep("Matteo/literature/", filelist, value = TRUE, fixed = TRUE)
# [1] "Matteo/literature/Subsetting.pdf"     
# [2] "Matteo/literature/datatable-intro.pdf"

You could easily build a function list.files.github from that.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to get all text files from one folder using Java?

how to get list of all files from folder inside java resources folder

How to push a project folder from IDEA to Github repository

How to list files in a folder from inside Postgres?

Get list of Excel files in a folder using VBA

GitHub get a list of all files in a repository from raw.githubusercontent?

How to download entire repository from Github using R?

How to get files list from public folder Laravel

How to get a list of a repository branches using Python

How get items from folder in Sharepoint list using JavaScript?

How to delete files from a folder using a list of file names in windows?

How to select files from folder A that are not in Folder B using Get-ChildItem

how to list files in a folder using bash scripting

How to get files from a commit, to a folder outside from my repository?

How to list files from a folder in opencms?

Java files in src folder are missing in github repository

get list of video files into csv from google disk using R

List files from certain folder using batch

How to list files from enterprise GitHub repository without cloning

Flutter How to get all files from assets folder in one List

How to get files submitted from a form into a local folder using javascript

How do I get file names from a directory in a repository using Github API

How to get list of all files and their raw contents under the GitHub project folder using the Java?

How to list files under a folder using jenkins

How to update a package from github when it was installed using apt-get and latest version not available in the deb repository?

How to get Base common folder from list of folder using Python?

How to get all the files of a Github repository using Javascript to create an index.html to access all the files

How to create a folder in the repository in GitHub?

How to get a tag from a branch in my repository using github actions?