1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax kernel quotations ;
4 IN: io.directories.search
8 { "path" "a pathname string" } { "bfs?" "a boolean, breadth-first or depth-first" } { "quot" quotation }
10 { $description "Performs a directory traversal, breadth-first or depth-first, and calls the quotation on the full pathname of each file." }
12 { $unchecked-example "USING: sequences io.directories.search ;"
13 "\"resource:misc\" t [ . ] each-file"
14 "! Recursive directory listing prints here"
18 HELP: recursive-directory
20 { "path" "a pathname string" } { "bfs?" "a boolean, breadth-first or depth-first" }
21 { "paths" "a sequence of pathname strings" }
23 { $description "Traverses a directory path recursively and returns a sequence of files in a breadth-first or depth-first manner." } ;
27 { "path" "a pathname string" } { "bfs?" "a boolean, breadth-first or depth-first" } { "quot" quotation }
28 { "path/f" "a pathname string or f" }
30 { $description "Finds the first file in the input directory matching the predicate quotation in a breadth-first or depth-first traversal." } ;
32 HELP: find-in-directories
34 { "directories" "a sequence of pathnames" } { "bfs?" "a boolean, breadth-first or depth-first" } { "quot" quotation }
35 { "path'/f" "a pathname string or f" }
37 { $description "Finds the first file in the input directories matching the predicate quotation in a breadth-first or depth-first traversal." } ;
41 { "path" "a pathname string" } { "bfs?" "a boolean, breadth-first or depth-first" } { "quot" quotation }
42 { "paths/f" "a sequence of pathname strings or f" }
44 { $description "Finds all files in the input directory matching the predicate quotation in a breadth-first or depth-first traversal." } ;
46 HELP: find-all-in-directories
48 { "directories" "a sequence of directory paths" } { "bfs?" "a boolean, breadth-first or depth-first" } { "quot" quotation }
49 { "paths/f" "a sequence of pathname strings or f" }
51 { $description "Finds all files in the input directories matching the predicate quotation in a breadth-first or depth-first traversal." } ;
53 { find-file find-all-files find-in-directories find-all-in-directories } related-words
55 ARTICLE: "io.directories.search" "Searching directories"
56 "The " { $vocab-link "io.directories.search" } " vocabulary contains words used for recursively iterating over a directory and for finding files in a directory tree." $nl
57 "Traversing directories:"
58 { $subsection recursive-directory }
59 { $subsection each-file }
61 { $subsection find-file }
62 { $subsection find-all-files }
63 { $subsection find-in-directories }
64 { $subsection find-all-in-directories } ;
66 ABOUT: "io.directories.search"