If a large number of objects are stored in a bucket, you can search for objects by specifying a prefix.

Limits

  • Search rules

    You can search for objects by prefix. The string used to search for objects is case-sensitive and cannot contain forward slashes (/).

  • Search results

    When you specify a prefix to search for objects in the root directory or a specified directory of a bucket, only the objects or subdirectories whose names contain the specified prefix are returned.

    Note If you want to recursively search for objects or directories in a directory of a bucket, you can call the GetBucket (ListObjects) operation or run the ls command of ossutil.

Procedure

  1. Log on to the OSS console.
  2. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the desired bucket.
  3. In the left-side navigation pane, choose Files > Objects.
  4. Search for objects.
    • Search for specific objects or directories in the root directory of the bucket

      In the upper-right corner, enter the prefix to search in the search box and press Enter or click the search icon to search for the objects. Objects and directories whose names contain the specified prefix within the root directory are displayed.

      The following example shows the search result when you specify Example as the prefix to search for objects and directories in the root directory of the bucket named TestBucket.

      Directory structure             Specified prefix          Search result
      TestBucket                         Example              Examplesrcfolder1                          
          └── Examplesrcfolder1                                Exampledestfolder.png                           
                 ├── test.txt                                
                 ├── abc.jpg
          └── Exampledestfolder.png
          └── example.txt
    • Search for specific objects or subdirectories in a specified directory of a bucket

      Click the directory that includes the objects or subdirectories that you want to search. Enter a prefix in the search box in the upper-right corner. Press Enter or click the search icon. Objects and subdirectories whose names contain the specified prefix in the directory are displayed.

      The following example shows the search result when you specify Project as the prefix to search for objects and subdirectories in the directory named Examplesrcfolder1.

      Directory structure             Specified prefix          Search result
      Examplesrcfolder1           Project               Projectfolder
          └── Projectfolder                                         ProjectA.jpg
                └── a.txt                         ProjectB.doc
                ├── b.txt
          └── ProjectA.jpg
          └── ProjectB.doc
          └── projectC.doc