1.3.0 permalink Arrow_down_16x16



  • (file-seq dir)
A tree seq on java.io.Files

1 Example top

  • ;; first create a Java File object using the file function in
    ;; the clojure.java.io package and use that object to create a file-seq
    ;; then show the first and first 10 members of that seq
    user=> (def f (clojure.java.io/file "c:\\clojure-1.2.0"))
    user=> (def fs (file-seq f))
    user=> (first fs)
    #<File c:\clojure-1.2.0>
    user=> (clojure.pprint/pprint (take 10 fs))
    (#<File c:\clojure-1.2.0>
     #<File c:\clojure-1.2.0\.gitignore>
     #<File c:\clojure-1.2.0\build.xml>
     #<File c:\clojure-1.2.0\changes.txt>
     #<File c:\clojure-1.2.0\cl.bat>
     #<File c:\clojure-1.2.0\clojure.jar>
     #<File c:\clojure-1.2.0\doc>
     #<File c:\clojure-1.2.0\doc\clojure>
     #<File c:\clojure-1.2.0\doc\clojure\pprint>
     #<File c:\clojure-1.2.0\doc\clojure\pprint\CommonLispFormat.markdown>)
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:4354 top

(defn file-seq
  "A tree seq on java.io.Files"
  {:added "1.0"
   :static true}
     (fn [^java.io.File f] (. f (isDirectory)))
     (fn [^java.io.File d] (seq (. d (listFiles))))
Vars in clojure.core/file-seq:
Used in 0 other vars

Comments top

No comments for file-seq. Log in to add a comment.