Reputation: 3663
I want to get all *.txt
files in the directory ../20180101_Folder
.
My code:
theFiles <- list.files(
path = "../*Folder",
pattern = "*.txt",
full.names = TRUE
)
But theFiles
ends up being NULL
. How do I make theFiles
equal to a list of all .txt
files in the specified directory?
Upvotes: 1
Views: 67
Reputation: 37661
list.files will expand ~ in a path, but will not expand wild-cards like *. To use those you need
path=Sys.glob("../*Folder")
Upvotes: 5