fs
fs copied to clipboard
dir_ls() glob does not work with subfolders
Hi,
I am on Windows using dir_ls()
to walk through all my csv files across various subfolders in a main folder.
For example, the base directory for the following example is C:\\Users\\mainfolder\\
, and I use the *
to represent all subfolders. There is a report
folder in every subfolder storing all csv files. (Note: the path I set here is the absolute one.)
dir_ls("C:\\Users\\mainfolder\\", glob = "*\\report\\*.csv", recurse = T)
It seems like glob
does not take two *
s. Any solutions for this issue? Thanks!
You can try to use dir_walk()
as a workaround.
For the issue, can you try to create a reproducible example? E.g. create a couple of directories with dir.create()
and then show that dir_ls()
does not work as expected? Thanks!