Hard to tell what your problem is with so little information to go on. Here's the code we use to get a directory listing:
(defn- wildcard-filter "Given a regex, return a FilenameFilter that matches." [re] (reify java.io.FilenameFilter (accept [_ dir name] (not (nil? (re-find re name)))))) (defn directory-list "Given a directory and a regex, return a sorted seq of matching filenames." [dir re] (sort (.list (clojure.java.io/file dir) (wildcard-filter re)))) On Mar 11, 2014, at 3:28 PM, Brandon Barret <mrbarret...@gmail.com> wrote: > > Hello all, > > I am working on a program that needs to list all the files in a directory. I > have read that Clojure doesn't yet have great support for this kind of task, > and that it is better to import java.io.File to your namespace in order to > use some of it's methods. Every time I have done this in Eclipse, I get the > same error: > > "No matching field found: getName for class java.lang.String (files.clj:0)" > > My question: Is this a "me" problem, perhaps a syntax error, a java problem, > or a Clojure problem? I have used java for quite a while, and think that I am > importing the class correctly: > > (import 'java.io.File), or should I just be using Clojure.java.io....confused > in this case.
signature.asc
Description: Message signed with OpenPGP using GPGMail