I call a java function in Clojure to get a list of files.
(require '[clojure.java.io :as io])
(str (.listFiles (io/file "/home/loluser/loldir")))
And I get a whole bunch of strings like these
#<File /home/loluser/loldir/lolfile1>
etc. How do I get rid of the brackets and put them in some form of an array so another function can access it?
Those strings are just the print format for a Java
Fileobject.See the File javadoc for which operations are available.
If you want the file paths as strings, it would be something like
Or you could just use
list, which returns strings in the first place:If you want to read the file, you might as well keep it as a File object to pass into the core
slurpor other clojure.java.io or clojure.contrib.duck-streams functions.