find

Finds all files that match the specified expression and applies selected actions to them. If no path is specified, then defaults to the current working directory. If no expression is specified, then defaults to -print.

The following primary expressions are recognized:

  • -name pattern;

  • -iname pattern.

Evaluates as true if the base name of the file matches the pattern using standard file system globbing. If -iname is used then the match is case-insensitive.

-print and -print0 always return true and are used to print the current path to stdout. If the -print0 expression is used, then an ASCII NULL character is appended.

The following operators are recognized:

  • expression -a expression;

  • expression -and expression;

  • expression expression.

The logical operator AND is used for joining two expressions.

Returns true if both child expressions return true. Implied by the juxtaposition of two expressions and so doesn’t need to be explicitly specified. The second expression won’t be applied if the first fails. Returns 0 on success and -1 on error.

The usage is as follows:

$ hadoop fs -find <path> ... <expression> ...

Example:

$ hadoop fs -find / -name test -print
Found a mistake? Seleсt text and press Ctrl+Enter to report it