Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
quickly locate files using glob patterns, for Clojure
branch: master

This branch is 20 commits ahead, 9 commits behind jkk:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src/org/satta
test/org/satta
.gitignore
README.md
project.clj

README.md

glob

Finds files based on glob patterns like "*.jpg" or "/usr/*/se*". Similar to glob in Perl, Ruby, and PHP.

Usage

(use 'org.satta.glob))

(glob "*.{jpg,gif}")
=> (#<File cat.jpg> #<File dog.gif>)

(glob "*.{jpg,gif}" :s)  ; return string of path by adding :s option
=> ("cat.jpg" "dog.gif")

(glob "*.JPG" :i)  ; ignore case.
=> (#<File cat.jpg>)

(glob ".*")  ; dot files are not included by default
=> (#<File .git> #<File .gitignore>)

(glob "*g*" :a)  ; dot files are included by adding :a option
=> (#<File .git> #<File .gitignore>)

(glob "/usr/*/se*")  ; works on directories and subdirectories
=> (#<File /usr/bin/security> #<File /usr/bin/sed> ...)

(glob "**/*clj")  ; zsh's ** recursive search can be used.
=> (#<File project.clj> #<File src/org/satta/glob.clj> #<File test/org/satta/glob_test.clj>)

(glob "c:/Windows/*/*.dll")  ; works on Windows

Caveats

  • Use slashes in glob pattern, the syntax is the same on Windows as *nix

Installation

Add this dependency to your project.clj:

[org.clojars.hozumi/clj-glob "0.1.2"]

License

EPL

Something went wrong with that request. Please try again.