mc find

mc find 命令用来查询对象。语法如下:

C:\> mc find -h
NAME:
  mc find - search for objects

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)
  --watch                       monitor a specified path for newly created object(s)
  --config-dir value, -C value  path to configuration folder (default: "C:\\Users\\Administrator\\mc")
  --quiet, -q                   disable progress bar display
  --no-color                    disable color theme
  --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.

示例

(1)在“local”帐户下的所有存储桶中查找所有“ping.txt”。

D:\server\minio>mc find local --name "ping.txt"
local/files/ping.txt

(2)在“local/files”下查找所有带有“.txt”扩展名的对象。

D:\server\minio>mc find local/files --name "*.txt"
local/files/ping.txt

(3)仅在“local/files”下查找没有目录组件的对象名称。

D:\server\minio>mc find local/files --name "*" -print {base}
ping.txt
start-minio.bat

(4)在“s3/photos”下查找所有带有“.jpg”扩展名、前缀为“album”的图像。

C:\> mc find s3/photos --name "*.jpg" --path "*/album*/*"

(5)使用“s3/photos”下的正则表达式查找所有带有“.jpg”、“.png”和“.gif”扩展名的图像。

C:\> mc find s3/photos --regex "(?i)\.(jpg|png|gif)$"

(6)在“s3/bucket”下找到所有带有“.jpg”扩展名的图像并复制到“play/bucket”*连续*。

C:\> mc find s3/bucket --name "*.jpg" --watch --exec "mc cp {} play/bucket"

(7)查找并生成有效期为 7 天的公共 URL,适用于“s3”帐户下大小介于 64 MB 和 1 GB 之间的所有对象。

C:\> mc find s3 --larger 64MB --smaller 1GB --print {url}

(8)在“local/images”下找到上周创建的所有对象。

D:\server\minio>mc find local/images --newer-than 7d
local/images/0f78ad1e685e9e972e3780ebfbdf2192.jpeg

(9)查找所有创建时间超过 2 天 5 小时 10 分钟的对象,并排除“local”下带有“.jpg”扩展名的对象。

D:\server\minio>mc find local --older-than 2d5h10m --ignore "*.jpg"
local/images
local/images/0f78ad1e685e9e972e3780ebfbdf2192.jpeg

(10)列出“local”下最多 3 级子目录的所有对象。

D:\server\minio>mc find local --maxdepth 3
local/files
local/files/ping.txt
local/files/start-minio.bat
local/images
local/images/0f78ad1e685e9e972e3780ebfbdf2192.jpeg
local/images/20210703221135.jpg
说说我的看法
全部评论(
没有评论
关于
本网站属于个人的非赢利性网站,转载的文章遵循原作者的版权声明,如果原文没有版权声明,请来信告知:hxstrive@outlook.com
公众号