yes it does.. user> (clojure.pprint/pprint (take 20 (file-seq (clojure.java.io/file"/")))) (#<File /> #<File /tmp> #<File /tmp/.ICE-unix> #<File /tmp/.ICE-unix/2262> #<File /tmp/CRX_75DAF8CB7768> #<File /tmp/CRX_75DAF8CB7768/manifest.json> #<File /tmp/CRX_75DAF8CB7768/crl-set> #<File /tmp/hsperfdata_gary> #<File /tmp/hsperfdata_gary/5728> #<File /tmp/hsperfdata_gary/5776> #<File /tmp/ksocket-gary> #<File /tmp/ksocket-gary/KSMserver__0> #<File /tmp/ksocket-gary/kdeinit4__0> #<File /tmp/ksocket-gary/klauncherhX2223.slave-socket> #<File /tmp/pulse-PKdhtXMmr18n> #<File /tmp/.com.google.Chrome.JWnc7T> #<File /tmp/.com.google.Chrome.JWnc7T/SingletonSocket> #<File /tmp/.com.google.Chrome.JWnc7T/SingletonCookie> #<File /tmp/kde-gary> #<File /tmp/kde-gary/xauth-1000-_0>)
On Mon, May 20, 2013 at 4:43 PM, Jim - FooBar(); <jimpil1...@gmail.com>wrote: > well no it doesn't descent into directories...I just tried it... > > Jim > > > On 20/05/13 21:39, Jim - FooBar(); wrote: > > actually yes it is! :) I thought file-seq was going down one level only > but looking at the implementation it seems it goes down all levels...I'm > trying it out now > > Jim > > On 20/05/13 21:31, Gary Trakhman wrote: > > Is this not sufficient? file-seq > https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4478 > > > On Mon, May 20, 2013 at 4:28 PM, Jim - FooBar(); <jimpil1...@gmail.com>wrote: > >> have you considered using mapcat recursively? something like this >> perhaps? >> >> (defn list-all-files [^java.io.File dir] >> (let [children (.listFiles dir) >> directories (filter #(.isDirectory %) children) >> files (filter #(.isFile %) children)] >> (concat files (mapcat list-all-files directories)))) >> >> Jim >> >> ps: I tried this on my 2T external drive which is almost full and I got >> tired of waiting after 15 minutes! No overflow, but no answer either... :) >> >> >> >> On 20/05/13 21:12, Ramesh wrote: >> >> Hi all, >> >> I have the following function to list all the files recursively under a >> directory. >> >> (defn list-all-files2 [path] >> (let [basepath (java.io.File. path)] >> (loop [origlist [basepath] finallist []] >> (if-let [cur (first origlist)] >> ;This line is not required (if (.isDirectory cur) >> (recur (concat (rest origlist) (.listFiles cur)) (conj finallist >> (.getCanonicalPath cur))) >> finallist)))) >> >> >> It runs fine, when the number of files are quite less, 10-20. >> >> But when I recurse through even moderately large amount of files, it >> fails with stackoverflow! The total number of files are not that much >> (50114). So even if each of the filename is 100 chars long, it would >> roughly take (5M bytes, which is 5MB). But I get a stack overflow error, >> and I have no clue. I think I am doing something wrong with the lazy >> functions. >> >> Here is the stacktrace: >> Exception in thread "main" java.lang.RuntimeException: >> java.lang.StackOverflowError >> at clojure.lang.Util.runtimeException(Util.java:165) >> at clojure.lang.Compiler.eval(Compiler.java:6476) >> at clojure.lang.Compiler.eval(Compiler.java:6455) >> at clojure.lang.Compiler.eval(Compiler.java:6431) >> at clojure.core$eval.invoke(core.clj:2795) >> at clojure.main$eval_opt.invoke(main.clj:296) >> at clojure.main$initialize.invoke(main.clj:315) >> at clojure.main$null_opt.invoke(main.clj:348) >> at clojure.main$main.doInvoke(main.clj:426) >> at clojure.lang.RestFn.invoke(RestFn.java:421) >> at clojure.lang.Var.invoke(Var.java:405) >> at clojure.lang.AFn.applyToHelper(AFn.java:163) >> at clojure.lang.Var.applyTo(Var.java:518) >> at clojure.main.main(main.java:37) >> Caused by: java.lang.StackOverflowError >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java:466) >> at clojure.core$seq.invoke(core.clj:133) >> at clojure.core$concat$fn__3528.invoke(core.clj:661) >> at clojure.lang.LazySeq.sval(LazySeq.java:42) >> at clojure.lang.LazySeq.seq(LazySeq.java:60) >> at clojure.lang.RT.seq(RT.java >> >> >> Thanks, >> ramesh >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >> >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.