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

Recursive walks down a directory #8814

Closed
prcastro opened this issue Oct 25, 2014 · 8 comments
Closed

Recursive walks down a directory #8814

prcastro opened this issue Oct 25, 2014 · 8 comments
Labels
good first issue Indicates a good issue for first-time contributors to Julia

Comments

@prcastro
Copy link
Contributor

To work with directories, a nice function to have is walk. It would walk down a directory and its subdirectories, and return a generator. Each step would give the user the current path, the subdirectories in that path, and the files inside that path.

It's similar to the function walk on Python's os library:
https://docs.python.org/2/library/os.html#os.walk

@johnmyleswhite
Copy link
Member

There are multiple implementations of this already floating around, including one in the FileFind package. The best way to move things forward is to do some work to clean up that package.

@StefanKarpinski
Copy link
Member

I think at this point I would support having a walkdir function in base. It should be quite simple and general, of course.

@remusao
Copy link
Contributor

remusao commented Nov 2, 2014

Maybe we could get some inspiration from the os module of Python that has some handy function like the one you are looking for : os.walk. @johnmyleswhite, from what I understand you use a callback to use on each file found in the way, what about an iterator-way of doing this?

@johnmyleswhite
Copy link
Member

Using an iterator could be cool. I'd just make sure you offer both DFS and BFS traversal of the directory tree.

@ghost
Copy link

ghost commented Nov 12, 2014

And if we were indeed going to improve on the FileFind package, using a iterative method would also help in keeping track of symlink calls.

I think at this point I would support having a walkdir function in base. It should be quite simple and general, of course.

@StefanKarpinski, did you have anything specific in mind that you want to see avoided in a walkdir function in order to keep it simple and general?

@ihnorton ihnorton added the good first issue Indicates a good issue for first-time contributors to Julia label May 8, 2015
dhoegh added a commit to dhoegh/julia that referenced this issue Oct 21, 2015
dhoegh added a commit to dhoegh/julia that referenced this issue Oct 21, 2015
dhoegh added a commit to dhoegh/julia that referenced this issue Oct 21, 2015
dhoegh added a commit to dhoegh/julia that referenced this issue Oct 22, 2015
dhoegh added a commit to dhoegh/julia that referenced this issue Oct 22, 2015
dhoegh added a commit to dhoegh/julia that referenced this issue Oct 22, 2015
dhoegh added a commit to dhoegh/julia that referenced this issue Oct 24, 2015
dhoegh added a commit to dhoegh/julia that referenced this issue Oct 24, 2015
hayd added a commit that referenced this issue Oct 24, 2015
bjarthur pushed a commit to bjarthur/julia that referenced this issue Oct 27, 2015
@dopatraman
Copy link

...walkdir is not in Julia v0.4.5...

@tkelman
Copy link
Contributor

tkelman commented May 11, 2016

We don't generally backport features. It is present in the Compat.jl package though: JuliaLang/Compat.jl#180

@dopatraman
Copy link

Made this gist if anyones looking: https://gist.github.com/dopatraman/6bb694e37e5f2360449e03702fe16f65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Indicates a good issue for first-time contributors to Julia
Projects
None yet
Development

No branches or pull requests

9 participants