fileutils for clojure

I just pushed clj-file-utils to clojars.

I was looking for an easy way to replicate ruby’s fileutils library in clojure and I came across a version by Mark McGranaghan in his clj-garden project which wraps around the Apache Commons IO library.

I extended Mark’s library by using multimethods to allow the use of strings (rather than requiring File objects) for parameters.

Usage

user=> (use 'clj-file-utils.core)  
nil
user=> (exist "foo.txt")
false
user=> (touch "foo.txt")
nil
user=> (exist "foo.txt")
true
user=> (rm "foo.txt")
nil
user=> (file "foo.txt")
#<File foo.txt>
user=> (.getParent (file "/path/to/foo.txt"))                         
"/path/to"

As A Dependency

leiningen

[clj-file-utils "0.1.1"]

maven

<dependency>
  <groupId>clj-file-utils</groupId>
  <artifactId>clj-file-utils</artifactId>
  <version>0.1.1</version>
</dependency>

Code

Share:
  • del.icio.us
  • Reddit
  • Technorati
  • Twitter
  • Facebook
  • Google Bookmarks
  • HackerNews
  • PDF
  • RSS
This entry was posted in programming. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.