Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve glob interface for dir_ls() #173

Open
jimhester opened this issue Feb 9, 2019 · 5 comments
Open

Improve glob interface for dir_ls() #173

jimhester opened this issue Feb 9, 2019 · 5 comments
Labels
feature a feature request or enhancement

Comments

@jimhester
Copy link
Member

jimhester commented Feb 9, 2019

This should work more like the command line

e.g. this should work

fs::dir_ls(glob = "/path/to/file*ext")

now you need to use something like

fs::dir_ls("/path/to", glob = "*file*ext")

Sys.glob("/path/to/file*ext") does work in this way.

@ralonso-igenomix
Copy link

Hi,

this would be a great functionality!
On the other hand, will it be like Sys.glob that you can put a regular expression in any part oh the path? I mean, in Sys.glob you can do this:
Sys.glob("/path/subpath1/*/subpath2/file*ext")
but I am not sure if in dir_ls you'll do:
fs::dir_ls(glob = "/path/subpath1/*/subpath2/file*ext")

Many thanks

@jimhester jimhester added the feature a feature request or enhancement label Mar 18, 2019
@grszkthfr
Copy link

Not sure if this is known/intended, but:
fs::dir_ls("/path/to", glob = "*file*ext") is not identical to Sys.glob("/path/to/file*ext"), as the first will find any file containing "file" (e.g. tmpfile_01.ext, file_02.ext, file.ext, ...) while the latter will find only those beginning with "file".

And following this: At the moment fs::dir_ls("/path/to", glob = "file*") is not working. It seems, that the glob argument needs to start with a wildcard to work properly. Not sure if this qualifies as an independent issue...

Best
Jonas

@ralonso-igenomix
Copy link

Dear,

any update on this?

Best,

Roberto

@yzliu01
Copy link

yzliu01 commented May 6, 2024

Hi,
How can we use a variable in glob= parameter?
It did not work with the below example:
group <- "vet_REF_pas"
glob = get(paste0("msmc.",group,"_out_non_empty.20bootstrap_chr*.final.txt"))

Error in get(paste0("msmc.", group, "_out_non_empty.20bootstrap_chr*.final.txt")) : 
  object 'msmc.vet_REF_pas_out_non_empty.20bootstrap_chr*.final.txt' not found

Best,
Liu

@gaborcsardi
Copy link
Member

@yzliu01 You don't need the get(), just the paste0().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

5 participants