Try to adapt my code:

https://gist.github.com/rauhs/63054a06631c0be598d3

where you change your accept function to incorporate:

http://stackoverflow.com/questions/813710/java-1-6-determine-symbolic-links

HTH

On Saturday, October 3, 2015 at 5:14:51 PM UTC-4, hpw...@gmail.com wrote:
>
> 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> 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 
>> > 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 
>> > 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. 
>> > 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