MinIO 客户端命令 mc rm 用来删除对象。语法如下:
C:\> mc rm -h
NAME:
mc rm - remove objects
USAGE:
mc rm [FLAGS] TARGET [TARGET ...]
FLAGS:
--versions remove object(s) and all its versions
--rewind value roll back object(s) to current version at specified time
--version-id value, --vid value delete a specific version of an object
--recursive, -r remove recursively
--force allow a recursive remove operation
--dangerous allow site-wide removal of objects
--incomplete, -I remove incomplete uploads
--fake perform a fake remove operation
--stdin read object names from STDIN
--older-than value remove objects older than L days, M hours and N minutes
--newer-than value remove objects newer than L days, M hours and N minutes
--bypass bypass governance
--encrypt-key value encrypt/decrypt objects (using server-side encryption with customer provided keys)
--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
ENVIRONMENT VARIABLES:
MC_ENCRYPT_KEY: list of comma delimited prefix=secret values(1)删除本地文件,如下:
D:\server\minio>mc rm ping.txt
Removing `ping.txt`.(2)执行假删除操作,如下:
D:\server\minio>mc rm --fake ping.txt
Removing `ping.txt`.执行完上面的 mc rm --fake 命令后,虽然提示删除成功;实际上 ping.txt 文件并没有被删除;
(3)从别名 Amazon S3 云存储中递归删除“jazz-songs”存储桶中前缀为 louis 的所有对象。
C:\> mc rm --recursive --force s3/jazz-songs/louis/(4)从别名 Amazon S3 云存储中递归删除“jazz-songs”存储桶中前缀为“louis”的所有早于 90 天的对象。
C:\> mc rm --recursive --force --older-than 90d s3/jazz-songs/louis/(5)从存储桶“pop-songs”中递归删除所有超过 7 天 10 小时的对象。
C:\> mc rm --recursive --force --newer-than 7d10h s3/pop-songs/(6)删除从 STDIN 读取的所有对象。
C:\> mc rm --force --stdin(7)从 Amazon S3 云存储中递归删除所有对象。
C:\> mc rm --recursive --force --dangerous s3(8)递归删除所有存储桶下超过“90”天的所有对象。
C:\> mc rm --recursive --dangerous --force --older-than 90d s3(9) 删除存储桶“jazz-songs”中所有不完整的上传。
C:\> mc rm --incomplete --recursive --force s3/jazz-songs/(10)从 Amazon S3 云存储中删除加密对象。
C:\> mc rm --encrypt-key "s3/sql-backups/=32byteslongsecretkeymustbegiven1" s3/sql-backups/1999/old-backup.tgz(11)在治理模式下绕过对象保留并删除对象。
C:\> mc rm --bypass s3/pop-songs/(12)删除特定版本 ID。
C:\> mc rm s3/docs/money.xls --version-id "f20f3792-4bd4-4288-8d3c-b9d05b3b62f6"(13)删除所有超过一年的对象版本。
C:\> mc rm s3/docs/ --recursive --versions --rewind 365d