public final class Main extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addLog(String spec)
Add logging at level
FINE on logger "de.unkrig" to STDERR using the "FormatFormatter"
and "SIMPLE" format, or the given arguments, which are all optional. |
static void |
help()
Print this text and terminate.
|
static void |
main(String[] args)
A command line utility to find files, directories and archive entries by various criteria, and optionally
execute some actions.
|
static void |
noLongerSupported()
(These are no longer supported; use "
--look-into" instead.) |
void |
setDebug()
Print verbose and debug messages.
|
void |
setDescendantsFirst()
Process each directory's contents before the directory itself, and each archive's entries before the archive
itself, and each compressed contents before the enclosing file or archive entry.
|
void |
setLookInto(de.unkrig.commons.text.pattern.Glob fomatAndPath)
Look into compressed and archive contents if the format and the path match the globs.
|
void |
setMaxDepth(int levels)
Descend at most levels of directories below the top level files and directories. "0" means "only
apply the tests and actions to the top level files and directories".
|
void |
setMinDepth(int levels) |
void |
setNowarn()
Suppress all messages except errors.
|
void |
setQuiet()
Suppress normal output.
|
void |
setVerbose()
Print verbose messages.
|
public static void main(String[] args)
zzfind [ option ] ... file-or-dir ... [ expression ]File name "-" stands for STDIN.
Expressions are either tests or actions (a test with side effects). Both evaluate to a boolean value.
-name glob-path globdir/file.zip!dir/file.zip!dir/file" or "dir/file") matches
"glob" (see below).
-type globzzfind with -echo "${type} ${path}" first.
-readable-writable-executable-size N-size -N-size +N100", "-1K",
"+10M").
-mtime N-mtime +N-mtime -N-mmin N-mmin +N-mmin -N-a exp2-and exp2'&&' exp2-o exp2-or exp2'||' exp2, exp2-not exp! exp( exp )-print-echo message${property-name}" in the message are replaced with
the value of the property. For the list of supported properties, see section "Properties of files and
archive entries", below.
-printf format expr ... ;java.util.Formatter, and the expressions support a Java-like syntax and can use all
properties.
For the list of supported properties, see section "Properties of files and archive entries", below.
is equivalent with "-printf
"%c%c%c%c %10d %6$tF %6$tT %7$s"
"directory ? 'd' : '-'"
"readable ? 'r' : '-'"
"writable ? 'w' : '-'"
"executable ? 'x' : '-'"
size
lastModifiedDate
path
;
-ls".
-ls-exec word... ;..." as an external command; "{}" is replaced with the current
file's path (which may contain "!" and would then NOT denote a physical file in the file system).
-pipe word... ;...";
"{}" is replaced with the current file's path (which may contain "!" and would then
NOT denote a physical file in the file system).
-cat-copy tofile${property-name}" in the tofile are replaced with
the value of the property. For the list of supported properties, see section "Properties of files and
archive entries", below.
-disassemble [ -verbose ] [ -sourceDirectory dir ] [ -hideLines ]
[ -hideVars ] [ -symbolicLabels ]
-digest algorithm-checksum CRC32|ADLER32-truetrue.
-falsefalse.
-prunetrue. If the file is a directory, do not descend into it.
-deletetrue if removal succeeded. If the removal failed, an error message is issued.
If you want to delete directories, also configure the --descendants-first option, for
otherwise the directory is first deleted, and then traversed, which cannot possibly work.
If no action is given, then "-print" is implicitly added.
Various tests and actions (e.g. "-echo") have access to a set of "properties" of the current file
or archive entry.
"name":"path":"depth":"type":directoryfilearchive-filearchive-xxx-resource (e.g. xxx="http")compressed-filecompressed-xxx-resource (e.g. xxx="http")archivenormal-contentsdirectory-entry"absolutePath":"canonicalPath":"lastModifiedDate":dow mon dd hh:mm:ss zzz yyyy".
"size":"isDirectory":"isFile":"isHidden":false for all other types.
"isReadable":false for all other types.
"isWritable":false for all other types.
"isExecutable":false for all other types.
"archiveFormat":"compressionFormat":Some archive entries have additional properties:
dir/filefile" in directory "dir"
file.gz%file.gz"
file.zip!dir/filedir/file" in archive file "dir/file.zip"
file.tar.gz%!dir/filedir/file" in the compressed archive file "file.tar.gz"
*/xx" in an immediate subdirectory
**/xx" in any subdirectory
***/xx" in any subdirectory, or any entry "**/x" in any archive file in any
subdirectory
a,dir/file.7z!dir/ba" and entry "dir/b" in archive file "dir/file.7z"
~*.c.c"
~*.c~*.h.c" or ".h"
~*.c~*.h,foo.cfoo.c" plus all files that don't end with ".c" or ".h"
public static void help()
throws IOException
IOExceptionpublic void setLookInto(de.unkrig.commons.text.pattern.Glob fomatAndPath)
${archive.formats}
${compression.formats}fomatAndPath - format-glob:path-globpublic void setDescendantsFirst()
public void setMinDepth(int levels)
Find.setMinDepth(int)public void setMaxDepth(int levels)
If in doubt, try:
zzfind ... -print -echo ${depth}public void setNowarn()
public void setQuiet()
public void setVerbose()
public void setDebug()
public static void addLog(String spec)
FINE on logger "de.unkrig" to STDERR using the "FormatFormatter"
and "SIMPLE" format, or the given arguments, which are all optional.spec - level:logger:handler:formatter:formatpublic static void noLongerSupported()
--look-into" instead.)Copyright © 2019 Arno Unkrig. All rights reserved.