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

Breadth-first option for fs/walk would be nice #50

Open
rmunn opened this issue Mar 16, 2013 · 1 comment
Open

Breadth-first option for fs/walk would be nice #50

rmunn opened this issue Mar 16, 2013 · 1 comment

Comments

@rmunn
Copy link
Contributor

rmunn commented Mar 16, 2013

I've encountered a case where I'd like to do a breadth-first traversal of a directory structure, and I don't see a way to do this with fs/walk as it currently stands.

My use case: I have a directory tree full of XML files representing various books and magazine articles. Each one has a cover page, linked to by an img element near the top of the XML file, and I'm trying to present a view to the user that shows some basic metadata: cover image, title, author, that sort of thing. Thing is, while the original directory structure had the cover images in the same directory as the content (and the img element in the XML has a src attribute with no path in it), some kind soul has "helpfully" reorganized the directory structure to collect all the cover images together. And while I could just hard-code the cover image directory into my code, that feels like the wrong solution to me: what if it changes again? I can't be constantly tweaking this code; it needs to Just Work.

So I want to do a fs/walk of the directory structure, starting from the library-root directory, to find the cover images. Thing is, there are several hundred directories in the tree, arranged something like this:

library-root/category1/book001
library-root/category1/book002
library-root/category1/book003
library-root/category2/book001
library-root/category2/book002
library-root/category2/book003
library-root/cover-images

Except it's more like six hundred bookNNN directories, not just six. A breadth-first traversal would find the right directory FAR sooner than a depth-first traversal would.

Unfortunately, I don't have quite enough Clojure expertise at this point to code it myself, or I would just write it and submit a pull request. But I would really like to see a breadth-first option for directory walking.

@samvit
Copy link

samvit commented Apr 22, 2013

  • 1

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

No branches or pull requests

2 participants