bm find
Syntax
The bm find command supports searching for objects on a Buckit deployment.
You can also use the command to search for files on a filesystem.
The following command searches for all objects matching the specified
pattern in the mydata bucket on the mybuckit Buckit deployment:
bm find mybuckit/mydata --name "*.jpg"
The command has the following syntax:
bm [GLOBALFLAGS] find \
[--exec "string"] \
[--ignore "string"] \
[--larger "string"] \
[--maxdepth "string"] \
[--metadata "string"] \
[--name "string"] \
[--newer-than "string"] \
[--older-than "string"] \
[--path "string"] \
[--print "string"] \
[--regex "string"] \
[--smaller "string"] \
[--tags "string"]` \
[--versions] \
[--watch] \
ALIAS
Brackets
[]indicate optional parameters.Parameters sharing a line are mutually dependent.
Parameters separated using the pipe
|operator are mutually exclusive.
Copy the example to a text editor and modify as-needed before running the command in the terminal/shell.
Parameters
- ALIAS
- Required
For objects on Buckit or an S3-compatible host, specify the alias and the full path to search (e.g. bucket and prefixes). For example:
bm find play/mydata/
For objects on a filesystem, specify the full path to search. For example:
bm find ~/mydata/
Issuing
bm find ALIASwith no other arguments returns a list of all objects or files at the specified path, similar tobm ls.
- --exec
- Optional
Spawns an external process for each object returned by
bm find. Supports substitution formatting of the output.
- --ignore
- Optional
Exclude objects whose names match the specified wildcard pattern.
- --larger
- Optional
Match all objects larger than the specified size in units.
- --name
- Optional
Return objects whose names match the specified wildcard pattern.
- --newer-than
- Optional
Mirror object(s) newer than the specified number of days. Specify a string in
#d#hh#mm#ssformat. For example:--older-than 1d2hh3mm4ssChanged in version RELEASE.2025-02-04T04-57-50Z: The datetime may also be specified in absolute time of
YYYY-MM-DD HH:MM:SS TMZformat. For example,bm find --newer-than="2025-01-22 09:57:00 CET" minioalias/mybucket.
- --older-than
- Optional
Mirror object(s) older than the specified time limit. Specify a string in
#d#hh#mm#ssformat. For example:--older-than 1d2hh3mm4ssChanged in version RELEASE.2025-02-04T04-57-50Z: The datetime may also be specified in absolute time of
YYYY-MM-DD HH:MM:SS TMZformat. For example,bm find --newer-than="2025-01-22 09:57:00 CET" minioalias/mybucket.Defaults to
0(all objects).
- --path
- Optional
Return the contents of directories whose names match the specified wildcard pattern.
- Optional
Prints results to
STDOUT. Supports substitution formatting of the output.
- --regex
- Optional
Returns objects or the contents of directories whose names match the specified PCRE regex pattern.
- --smaller
- Optional
Match all objects smaller than the specified size in units.
- --watch
- Optional
Continuously monitor the
ALIASand return any new objects which match the specified criteria.
Global Flags
This command supports any of the global flags.
Examples
Find a Specific Object in a Bucket
bm find ALIAS/PATH --name NAME
Find Objects with File Extension in Bucket
bm find ALIAS/PATH --name *.EXTENSION
Find All Matching Files and Copy To S3 Service
Use bm find with the --exec option to find
files on a local filesystem and pass them to an bm command for
further processing. The following example uses bm cp to copy the
output of bm find to an S3-compatible host.
bm find FILEPATH --name "*.EXTENSION" --exec "bm cp {} ALIAS/PATH"
Replace
FILEPATHwith the full file path to the directory to search.Replace
EXTENSIONwith the file extension of the object.Replace
PATHwith the path to a bucket on the S3-compatible host.
To continuously watch the specified directory and copy new objects,
include the --watch argument:
bm find --watch FILEPATH --name "*.EXTENSION" --exec "bm cp {} ALIAS/PATH"
Find Objects with a Matching Tag
Note
Tag matching is only available for use on Buckit deployments.
bm find --tags="key=v*" ALIAS/BUCKET/
Replace
keywith the name of a tag key to match.Replace
v*with the RE2 Regular Expression to evaluate against.Replace
ALIASwith thealiasof the Buckit deployment.Replace
BUCKETwith the bucket or prefix to search.
You can add additional --tags="key=RegExpression" flags to match.
Matching objects must match all included tags.
Find Objects with Matching Metadata
Note
Metadata matching is only available for use on Buckit deployments.
bm find --json --metadata="content-type=text/csv" ALIAS/BUCKET/
Replace
content-type=text/csvwith the a key-value pair of the metadata field and value to match.Replace
ALIASwith thealiasof the Buckit deployment.Replace
BUCKETwith the bucket or prefix to search.
You can add additional --tags="metadata=value" flags to match.
Matching objects must match all included metadata fields.
Behavior
Units of Measurement
The bm find --smaller and bm find --larger flags
accept the following case-insensitive suffixes to represent the unit of the
specified size value:
Suffix |
Unit Size |
|---|---|
|
KB (Kilobyte, 1000 Bytes) |
|
MB (Megabyte, 1000 Kilobytes) |
|
GB (Gigabyte, 1000 Megabytes) |
|
TB (Terabyte, 1000 Gigabytes) |
|
KiB (Kibibyte, 1024 Bites) |
|
MiB (Mebibyte, 1024 Kibibytes) |
|
GiB (Gibibyte, 1024 Mebibytes) |
|
TiB (Tebibyte, 1024 Gibibytes) |
Omitting the suffix defaults to bytes.
Substitution Format
The bm find --exec and bm find --print commands
support string substitutions with special interpretations for following
keywords.
The following keywords are supported for both filesystem and S3 service targets:
{}- 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.
The following keyword is supported only for S3 service targets:
{url}- Substitutes to a shareable URL of the path.
S3 Compatibility
The bm commandline tool is built for compatibility with the AWS S3 API and is tested with Buckit and AWS S3 for expected functionality and behavior.
Buckit provides no guarantees for other S3-compatible services, as their S3 API implementation is unknown and therefore unsupported. While bm commands may work as documented, any such usage is at your own risk.