JavaFind

This is a 100% Java implementation of the familiar Unix find utility.  Being a Java library, it's very easy to integrate into any Java application.  It provides flexible cross-platform file searching.

Features

Automatically detects and delegates work to GNU find & perl when it will save time.  This can be controlled via the system property:

-Djavafind.allowoptimize=[on|off|regex]

on = Always delegate to GNU tools if it can.
off = Never use GNU tools - always use 100% Java.
regex = (default) Use GNU tools only when a regex has been
specified.

Set the following property to see at runtime what the optimization status is:

-Djavafind.debug=true

Allows matching filesnames based on Perl 5 style regular expressions.

The library can be used from other Java classes, or from the command line.

Supports some useful GNU find-like functions:
  • mindepth - Specify a minimum depth to begin finding files at
  • maxdepth - Specify a maximum depth to search
  • follow - Can be set to follow or not follow symbolic links on unix computers. This needs more testing on Windows.
  • file types - "Directory" and/or "Plain file" can be specified

Supports some extra options from other GNU tools:
  • negated - Specify if files NOT matching the regex should be returned. (The idea for this was taken from egrep's handy -v option.)
  • exclude dirs - Specify a set of directories to exclude from the search. (The idea for this was taken from tar.)
Has a useful public method, "isSymLink()".

Requirements

This package requires Jakarta ORO for regex matching.

JavaFind Project Site
For access to the source code.

Robb Shecter
SourceForge.net Logo