mc find

Find objects meeting the specified criteria.

Syntax

CLI
USAGE:
  mc find PATH [FLAGS]

FLAGS:
  --exec value                  spawn an external process for each matching object (see FORMAT)
  --ignore value                exclude objects matching the wildcard pattern
  --name value                  find object names matching wildcard pattern
  --newer-than value            match all objects newer than L days, M hours and N minutes
  --older-than value            match all objects older than L days, M hours and N minutes
  --path value                  match directory names matching wildcard pattern
  --print value                 print in custom format to STDOUT (see FORMAT)
  --regex value                 match directory and object name with PCRE regex pattern
  --larger value                match all objects larger than specified size in units (see UNITS)
  --smaller value               match all objects smaller than specified size in units (see UNITS)
  --maxdepth value              limit directory navigation to specified depth (default: 0)
  --json                        enable JSON lines formatted output
  --debug                       enable debug output
  --insecure                    disable SSL certificate verification
  --help, -h                    show help

UNITS
  --smaller, --larger flags accept human-readable case-insensitive number
  suffixes such as "k", "m", "g" and "t" referring to the metric units KB,
  MB, GB and TB respectively. Adding an "i" to these prefixes, uses the IEC
  units, so that "gi" refers to "gibibyte" or "GiB". A "b" at the end is
  also accepted. Without suffixes the unit is bytes.

  --older-than, --newer-than flags accept the string for days, hours and minutes
  i.e. 1d2h30m states 1 day, 2 hours and 30 minutes.

FORMAT
  Support string substitutions with special interpretations for following keywords.
  Keywords supported if target is filesystem or object storage:

     {}     --> Substitutes to full path.
     {base} --> Substitutes to basename of path.
     {dir}  --> Substitutes to dirname of the path.
     {size} --> Substitutes to object size of the path.
     {time} --> Substitutes to object modified time of the path.

  Keywords supported if target is object storage:

     {url} --> Substitutes to a shareable URL of the path.

Parameters

Parameter Description
PATH The path to search for objects. This path can be on the local filesystem or be the alias of a configured HPE Ezmeral Object Store deployment. This parameter is mandatory.
exec Spawn an external process for each matching object.
ignore Ignore objects matching this wild card specification.
name Find objects matching this wild card specification. This parameter is mandatory.
newer-than Find all objects that are newer than the specified days, hours or minutes.
older-than Find all objects that are older than the specified days, hours or minutes.
path Find directory names that match the wildcard pattern.
print Print the search results in a custom format.
regex Find objects and directories that match the specified regular expression.
larger Find objects that are larger than the specified size.
smaller Find objects that are smaller than the specified size.
maxdepth Restrain directory navigation to the specified depth. For example, the value 3 limits the searching to 3 levels deep from the top-level directory. The default value of 0 indicates no limit.
json Enable JSON formatted output.
debug Enable output for debugging.
insecure Disable SSL verification.
help Show this help.

Examples

  1. Find all occurrences of the object foo.jpg in all buckets in the Object Store deployment with alias salesobject:
    CLI
    /opt/mapr/bin/mc find salesobject --name foo.jpg
  2. Find all objects in the Object Store deployment with alias salesobject that are older than 2 days, 5 hours and 10 minutes and exclude the ones with the .jpg extension:

    CLI
    /opt/mapr/bin/mc find salesobject --older-than 2d5h10m --ignore "*.jpg"
  3. Find only the object names without the directory component in the bucket named northamerica in the Object Store deployment with alias salesobject.
    CLI
    /opt/mapr/bin/mc find salesobject/northamerica --name "*" -print {base}
  4. Find all images with the .jpg extension in the bucket named northamerica in the Object Store deployment with alias salesobject and simultaneously copy the images to the bucket named philo in the Object Store deployment with alias asia:
    CLI
    /opt/mapr/bin/mc find salesobject/northamerica --name "*.jpg" --watch --exec "mc cp {} philo/asia"