The directory structure is
   /path/top/dir1
   /path/top/dir1/f1
   /path/top/dir1/f2
   /path/top/dir2 -> /another/path/dir2 
----------
   /another/path/dir2/g1
   /another/path/dir2/g2

I tried this (following suggestion):
   
  (for [file (file-seq dir) :while (.isFile file)] (.getPath file))

It prints out a list with following items:
  /path/top/dir1/f1
  /path/top/dir1/f2
  /path/top/dir2/g1
  /path/top/dir2/g2

BUT the last two items are the ones that I do NOT want.
So, I guess I will need to tweak  file-seq so that it will NOT traverse
/path/top/dir2  since it is a symbolic link.

Is there anyway to tweak file-seq ??

THanks
HP

On Saturday, October 3, 2015 at 11:59:40 AM UTC-4, Gary Verhaegen wrote:
>
> 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,  <hpw...@gmail.com <javascript:>> 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 clo...@googlegroups.com 
> <javascript:> 
> > Note that posts from new members are moderated - please be patient with 
> your 
> > first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@googlegroups.com <javascript:> 
> > 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+u...@googlegroups.com <javascript:>. 
> > 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