I'm on Windows at the moment, so I can't test, but I think you can
filter on isFile:

(for [file (file-seq dir)
      :where (.isFile file)]
  (.getName file))

should work, I think.

On 3 October 2015 at 07:36,  <hpwe...@gmail.com> wrote:
> Under linux, I have a tree of directories like this:
>
> /path/top
>
> /path/top/dir1  (in here there are two files f1, f2)
>
> /path/top/dir2 -> /another-path/dir2 (a symbolic link)
>
>                  and under /another-path/dir2 there are two files g1, g2
>
> If I use below code, I would get a list of files f1, f2, and g1, g2
>
> (def directory (clojure.java.io/file "/path/top"))
> (def files
>     (for [file (file-seq directory)] (.getName file)))
> (files)
>
> BUT I want to skip traversing the directory dir2 since it is a symbolic
> link.
>
> i.e. the list of files that I want to get is f1, f2 only.
>
> Could you please suggest a way to do this ?
>
> THanks
>
> HP
>
> --
> 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/d/optout.

-- 
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/d/optout.

Reply via email to