All Products
Search
Document Center

Object Storage Service:Advanced commands

Last Updated:Jun 03, 2026

Configure advanced ossutil options for batch operations, filtering, metadata, and transfer control.

Command descriptions

Command scope

Supported options

All advanced commands

  • --encoding-type string: Encoding for input object or file names. Valid value: url.

  • --request-payer string: Enables pay-by-requester mode. Set to `requester`.

Commands that support batch operations

  • --start-after/--end-with (, ]: Key range filter. Exclusive start, inclusive end.

  • filter options: Filter by object/file name, folder, size, time, or metadata. Filter options.

  • --limited-num: Limits the number of results returned per API query.

  • --recursive/-r: Recurses into all subdirectories.

  • --dirs/-d: Lists only the current directory, excluding subdirectories.

    Note

    For objects, this uses the Delimiter method and scans all objects under the prefix. More objects means longer scan time.

  • --force/-f: Forces the operation without a confirmation prompt.

  • --list-objects: Uses the ListObjects API to list objects.

Commands that support destination filtering rules

  • --update: Compares only the modification time. Synchronizes only when the source is newer than the destination.

  • --size-only: Compares only the file size. Synchronizes only data with a different file size.

  • --checksum: Compares file size first, then CRC-64 checksum. If the checksum is missing on either side, files are treated as inconsistent. Valid only for object-to-object copies.

  • --ignore-existing: Skips existing files.

Commands that support single objects

--version-id string: The version ID of the object.

Commands that support list mode

--list-format: The format of the list file. Valid values: plain and inventory.

--list-manifest-from: Reads the description of the list file format from a file. This parameter is required when the list file format is inventory.

Local options

Local option

Option type

Description

--encoding-type

string

Encoding for input object or file names. Valid value: url.

--request-payer

string

Enables pay-by-requester mode. Valid value: requester.

--start-after

string

Returns objects alphabetically after the specified value (exclusive).

--end-with

string

Returns objects alphabetically up to the specified value (inclusive).

--page-size

int

Maximum objects per page in batch processing. Default: 1000. Range: 1 to 1000.

--include

stringArray

The inclusion rule for paths or file names.

--include-from

stringArray

Reads inclusion rules from a rule file.

--exclude

stringArray

The exclusion rule for paths or file names.

--exclude-from

stringArray

Reads exclusion rules from a rule file.

--filter

stringArray

The filter rule for paths or file names.

--files-from

stringArray

Reads a list of source file names from a file. Empty lines or comment lines are ignored. This applies only to file filtering operations.

--files-from-raw

stringArray

Reads a list of source file names from a file. This applies only to file filtering operations.

--max-age

Duration

Skips files older than this age. Default unit: seconds. Supports suffixes: ms, s, m, h, d, w, M, y. Default: off.

--min-age

Duration

Skips files newer than this age. Default unit: seconds. Supports suffixes: ms, s, m, h, d, w, M, y. Default: off.

--max-mtime

Time

Skips files newer than this UTC timestamp. Default: off.

--min-mtime

Time

Skips files older than this UTC timestamp. Default: off.

--max-size

SizeSuffix

Maximum file size to transfer. Default unit: bytes. Supports suffixes: B, K, M, G, T, P. 1 K (KiB) = 1024 B.

--min-size

SizeSuffix

Minimum file size to transfer. Default unit: bytes. Supports suffixes: B, K, M, G, T, P. 1 K (KiB) = 1024 B.

--metadata-exclude

stringArray

The exclusion rule for object metadata.

--metadata-include

stringArray

The inclusion rule for object metadata.

--metadata-filter

stringArray

The filter rule for object metadata.

--metadata-filter-from

stringArray

Reads object metadata filter rules from a rule file.

--checksum

/

Copies only source files whose size and checksum (if it exists) are inconsistent.

--size-only

/

Copies only source files with an inconsistent size.

-u, --update

/

Copies only source files that are newer than the destination files.

-r, --recursive

/

Operates on all matching objects in the bucket recursively. Without this option, operates only on the specified path.

-d, --dirs

/

Lists only files and subdirectories in the current folder, without recursion.

-f, --force

/

Forces the operation without a confirmation prompt.

--list-objects

/

Uses the ListObjects API to list objects.

--no-progress

/

Does not display the progress bar.

-j, --job

int

Concurrent tasks for multi-file operations. Default: 3.

--checkers

int

Parallel checkers. Default: 16.

--parallel

int

Concurrent tasks for single-file multipart operations.

--part-size

SizeSuffix

Part size for multipart operations. Auto-calculated by default. Range: 100 KiB to 5 GiB.

--bigfile-threshold

int

Size threshold for multipart upload, download, or copy. Default: 104857600 (100 MiB).

--version-id

string

The version ID of the object.

--storage-class

string

The storage class of the object. Valid values: Standard, IA, Archive, ColdArchive, and DeepColdArchive.

--acl

string

The access permissions of the object. Valid values: private, public-read, public-read-write, and default.

--cache-control

string

Controls browser caching behavior when the object is downloaded.

--content-disposition

string

Display format of the object.

--content-encoding

string

Content encoding of the object.

--content-type

string

The content type of the object.

--expires

string

Absolute expiration time for cached content.

--copy-props

string

Properties to copy from the source object. Valid values: none, metadata, default.

--tagging

string

Object tags in key=value format.

--tagging-directive

string

How to set destination object tags. Valid values: COPY, REPLACE.

--metadata

string

User metadata in key=value format.

--metadata-directive

string

How to set destination object metadata. Valid values: COPY, REPLACE.

--list-format

string

The format of the list file. Valid values: plain and inventory.

--list-manifest-from

string

Reads the description of the list file format from a file. This parameter is required when the list file format is inventory.

Filter options

Filter options apply to batch commands (ls, cp, sync, rm). Filter by path/file name, file list, modification time, file size, or object metadata.

Filter options are available only on the command line, not in configuration files.

Test filter configurations with ls or --dry-run/-n before applying changes.

Filter by path/file name

Define filter rules to specify which files to include or exclude by name or path.

You can define rules using the --include and --exclude options. For example, --include="*.txt" and --exclude="*".

Specify rules via command-line options or rule files. Multiple rules form an ordered list that filters results by these principles:

  • Rules are processed in order. Parameters in a command are processed from left to right, and rules in a file are processed from top to bottom.

  • Each file or path is checked against the rules to determine whether it should be included or excluded.

  • The rules are checked in order. The check stops as soon as a rule is matched.

  • If no rules are matched, the file or path is included by default.

  • On a local file system, if a folder is excluded, all its subfolders and files are also excluded.

  • Because buckets do not have a folder structure, each object is filtered individually.

Glob matching patterns are used. The following are common rules for glob matching patterns:

  • If a pattern starts with /, it must match the beginning of the path. Otherwise, it can match a name at any level of the path.

  • If a pattern ends with /, it matches only folders. Otherwise, it can match folders or files. For example, dir/.

  • A / character represents a path separator. For example, subdir/test.txt.

  • * matches any string of characters of any length, but does not match /. For example, *.txt.

  • If a pattern ends with **, it matches any string of characters of any length, including /. For example, dir/** matches the path "dir/subdir/xx/test.txt".

  • ? matches any single character except /.

  • [] matches a single character from a specific class. For example, [a-z] matches a lowercase letter, and [0-9] matches a digit.

  • By default, a pattern must match the entire file or folder name. For example, `foo` matches "foo" and "dir/foo", but does not match "dir/foo1" or "foo/xx".

  • The pattern must match a complete folder or file name, not part of a name. For example, `foo` does not match "xxx/afoo", and `abc/foo` does not match "subdir/aabc/foo".

Note

On Windows, use / as the path separator, not \.

You can create an ordered list of path and file name filter rules by specifying one or more of the following syntax and parameters on the command line:

Item

Description

Filter rule syntax

  • rule pattern rule option parameter: A Glob matching pattern.

  • rule filename rule option parameter: The path of a file that contains Glob matching pattern rules.

  • rule modifiers pattern rule option parameter: An instruction Glob matching pattern. The + instruction indicates an inclusion rule. Objects that match this rule are included in the result. The - instruction indicates an exclusion rule. Objects that match this rule are excluded from the result.

Filter rule option parameters

  • --include

  • --include-from

  • --exclude

  • --exclude-from

  • --filter

  • --filter-from

The following table describes the common options:

Option

Description

--include

--exclude

The parameter is followed by a matching pattern. Each option represents one rule. To use multiple rules, repeat these options.

For example, --include "*.txt" --include "*.js" --exclude "*.jpg" includes all .txt and .js files, but excludes all .jpg files.

The following example command recursively downloads files that match the filter rules from the oss://examplebucket/exampledir/ folder in Alibaba Cloud OSS to the localdir/ folder. The rules include all .txt and .js files, but exclude all .jpg files.

ossutil cp -r oss://examplebucket/exampledir/ localdir/ --include "*.txt" --include "*.js" --exclude "*.jpg"

--filter

The parameter is followed by an instruction matching pattern. Each option value represents one rule. To use multiple rules, repeat these options.

For example, --filter "+ *.txt" --filter "+ *.js" --filter "- *.jpg" includes all .txt and .js files, but excludes all .jpg files.

  • The + symbol indicates an inclusion rule. Objects that match this rule are included in the result.

  • The - symbol indicates an exclusion rule. Objects that match this rule are excluded from the result.

The following example command recursively downloads files that match the filter rules from the oss://examplebucket/exampledir/ folder in Alibaba Cloud OSS to the localdir/ folder. The rules exclude .txt and .js files, and include only .png files.

ossutil cp -r oss://examplebucket/exampledir/ localdir/ --filter "- *.txt" --filter "- *.js" --filter "+ *.png"

--include-from

--exclude-from

The parameter is followed by a rule file path. Each line in the rule file represents a Glob matching pattern. To import multiple rule files, repeat these options.

All rules imported with --include-from are inclusion rules. All rules imported with --exclude-from are exclusion rules.

For example, --include-from include-file.txt --exclude-from exclude-file.txt includes all .txt and .js files, but excludes all .jpg files.

The content of the rule file include-file.txt is as follows:

 *.txt
 *.js

The rule file include-file.txt contains the following:

 *.jpg

--filter-from

The parameter is followed by a rule file path. Each line in the rule file represents an instruction Glob matching pattern.

To import multiple rule files, repeat these options.

For example, in --filter-from filter-file.txt, the content of the rule file filter-file.txt is as follows:

 # a filter rule file
 + *.txt
 + *.js
 - **

Additional information:

  • When you read rules from a file, the rules are processed from top to bottom. Empty lines and comment lines that start with # or ; are ignored.

  • If the file path is -, the rules are read from standard input (stdin). You can specify this option only once.

  • If you use the --include or --include-from rule, a - ** rule is added to the end of the rule list.

  • If you use the --filter + pattern, a - ** rule is not added to the end of the rule list.

For example, to configure a rule that includes only files with the .jpg extension using --filter, you must specify `--filter "+ *.jpg" --filter "- **"`.

Note

You cannot use the --filter or --filter-from options in combination with the --include, --include-from, --exclude, or --exclude-from options.

Filter by path/file list

You can specify a list of paths or file names using command-line options. The supported options are as follows:

Option

Description

--files-from

Reads a list of paths/file names from a file. You can repeat this option to use multiple list files.

When processing each line in the list file, leading or trailing spaces are removed, and comment lines starting with # or ; are ignored.

--files-from-raw

Reads a list of paths/file names from a file. You can repeat this option to use multiple list files.

When processing each line in the list file, leading or trailing spaces and comment lines starting with # or ; are not ignored.

Note

If you specify a list of paths or files to match, other pattern matching rules are ignored.

Filter by file time

Filter by last-modified time to transfer only files within a specific time range.

Time filters support relative and absolute modes:

Parameter

Description

--min-age

Duration

Processes only files modified before the specified interval. Default unit: seconds. Supports unit suffixes, e.g. 1h.

Note

--min-age 1h means process files modified 1 hour ago or earlier.

--max-age

Duration

Processes only files modified within the specified interval. Default unit: seconds. Supports unit suffixes, e.g. 1h.

Note

--max-age 1h means process files modified within the last hour.

--min-mtime

Time

Processes only files modified after the specified UTC time. Example: 2006-01-02T15:04:05.

Note

--min-mtime "2006-01-02T15:04:05" means process files modified after 15:04:05 on January 2, 2006.

--max-mtime

Time

Processes only files modified before the specified UTC time. Example: 2006-01-02T15:04:05.

Note

--max-mtime "2006-01-02T15:04:05" means process files modified before 15:04:05 on January 2, 2006.

Additional information:

  • Supported unit suffixes for --min-age and --max-age: ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), w (weeks), M (months), y (years).

  • Decimal values are supported, e.g. 1.5d for one and a half days.

Example: List files or objects that are more than 3 days old.

ossutil ls oss://bucket/ --min-age 3d

Filter by file size

Filter by file size to transfer only files within a specific size range.

Configuration parameters:

Parameter

Description

--min-size

Skips files smaller than this size. Default unit: bytes. Example: 1K (KiB) = 1024 bytes.

--max-size

Skips files larger than this size. Default unit: bytes. Example: 1K (KiB) = 1024 bytes.

Additional information:

  • Supported suffixes: K (KiB) = 1024 bytes, M (MiB), G (GiB), T (TiB), P (PiB), E (EiB).

  • Decimal values are supported, e.g. 0.5K.

Example: List files or objects that are 1 MiB or smaller.

ossutil ls oss://bucket/ --max-size 1M

Filter by object metadata matching rules

Metadata filters work like path/file name filters but apply only to bucket objects.

Define metadata as `key=value` with glob patterns for matching.

The following configuration options are supported:

  • --metadata-include

  • --metadata-exclude

  • --metadata-filter

  • --metadata-filter-from

The following object metadata is supported:

  • Storage class: Use `x-oss-storage-class=value`. Valid values for `value` are Standard, IA, Archive, ColdArchive, and DeepColdArchive.

  • Object type: Use `x-oss-object-type=value`. Valid values for `value` are Normal, Multipart, Appendable, and Symlink.

  • Restore status: Use `x-oss-restore=value`. Set `value` as needed.

  • Content-Type: Use `content-type=value`. Set `value` as needed.

  • User-defined metadata: Use `x-oss-meta-aaa=value`, where `aaa` is in lowercase. Set `value` as needed.

Example: List objects whose storage class is Archive, Cold Archive, or Deep Cold Archive.

ossutil ls oss://bucket/ --metadata-include "x-oss-storage-class=*Archive"