Queries the subdirectories or files in a specified directory of General-purpose NAS file system.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListDirectoriesAndFiles

The operation that you want to perform.

Set the value to ListDirectoriesAndFiles.

FileSystemId String Yes 31a8e4****

The ID of the file system.

Path String Yes /pathway/to/folder

Specifies the absolute path of the directory.

The path must be prefixed by a forward slash (/). It must be a path that exists in the mount target.

StorageType String Yes InfrequentAccess

The storage type of the files.

Default value: InfrequentAccess (IA).

NextToken String No TGlzdFJlc291cmNlU****mVzJjE1MTI2NjY4NzY5MTAzOTEmMiZORnI4NDhVeEtrUT0=

The token that is used to initiate the next request if the response of the current request is truncated. You can use the token to initiate another request and obtain the remaining records.

DirectoryOnly Boolean No false

Specifies whether to enable queries of only directories.

Valid values:

  • false (default): enables queries of both directories and files
  • true: enables queries of only directories
MaxResults Long No 100

The maximum number of directories or files to include in the results of each query.

Valid values: 10 to 128

Default value: 100

Response parameters

Parameter Type Example Description
Entries Array of Entry

The details about the files or directories.

Atime String 2021-02-01T10:08:08Z

The time range for the query.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format.

The value of this parameter is returned and valid only if the value of the Type parameter is File.

Ctime String 2021-02-11T10:08:10Z

The time when the raw data was modified.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format.

The value of this parameter is returned and valid only if the value of the Type parameter is File.

HasInfrequentAccessFile Boolean true

Indicates whether the files contain the data that is dumped to the IA storage medium.

The value of this parameter is returned and valid only if the value of the Type parameter is File.

Valid values:

  • true: The files contain the data that is dumped to the IA storage medium.
  • false: The files do not contain the data that is dumped to the IA storage medium.
Inode String Inode

The file or directory inode.

Mtime String 2021-02-11T10:08:08Z

The time when the file was last modified.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format.

The value of this parameter is returned and valid only if the value of the Type parameter is File.

Name String file.txt

The name of the files or directory.

RetrieveTime String 2021-02-11T10:08:08Z

The time when the data retrieval job is last run.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format.

The value of this parameter is returned and valid only if the value of the Type parameter is File.

Size Long 1024

The size of the files.

Unit: bytes.

The value of this parameter is returned and valid only if the value of the Type parameter is File.

StorageType String InfrequentAccess

The storage type of the returned files.

The value of this parameter is returned and valid only if the value of the Type response parameter is File.

Valid value:

  • standard: General-purpose NAS file system
  • InfrequentAccess: IA storage medium
Type String File

The type of the query result.

Valid values:

  • File
  • Directory
NextToken String TGlzdFJlc291cmNlU****mVzJjE1MTI2NjY4NzY5MTAzOTEmMiZORnI4NDhVeEtrUT0=

The token that is used to initiate the next request if the response of the current request is truncated. You can use the token to initiate another request and obtain the remaining records.

RequestId String 2D69A58F-345C-4FDE-88E4-BF518948****

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ListDirectoriesAndFiles
&FileSystemId=31a8e4****
&Path=/pathway/to/folder
&StorageType=InfrequentAccess
&<Common Request Parameters>

Sample success responses

XML format

<NextToken>aBcdeg==</NextToken>
<RequestId>BC7C825C-5F65-4B56-BEF6-98C56C7C****</RequestId>
<Entries>
    <Name>test.txt</Name>
    <Type>File</Type>
    <Inode>1000</Inode>
    <Size>20</Size>
    <Atime>2019-10-30T10:08:08Z</Atime>
    <Mtime>2019-10-30T10:08:08Z</Mtime>
    <CTime>2019-10-30T10:08:08Z</CTime>
    <RetrieveTime>2019-10-30T10:08:08Z</RetrieveTime>
    <StorageType>InfrequentAccess</StorageType>
</Entries>
<Entries>
    <Name>testDirectory</Name>
    <Type>Directory</Type>
    <Inode>1001</Inode>
    <HasInfrequentAccessFile>true</HasInfrequentAccessFile>
</Entries>

JSON format

{
    "NextToken": "aBcdeg==",
    "RequestId": "BC7C825C-5F65-4B56-BEF6-98C56C7C****",
    "Entries": [
      {
        "Name": "test.txt",
        "Type": "File",
        "Inode":1000,
        "Size": 20,
        "Atime": "2019-10-30T10:08:08Z",
        "Mtime": "2019-10-30T10:08:08Z",
        "CTime": "2019-10-30T10:08:08Z",
        "RetrieveTime": "2019-10-30T10:08:08Z",
        "StorageType": "InfrequentAccess"
      },
      {
        "Name": "testDirectory",
        "Type": "Directory",
        "Inode":1001,
        "HasInfrequentAccessFile":true
      }
    ]
  }

Error codes

HttpCode Error code Error message Required
400 OperationDenied.InvalidNextToken The specified NextToken is invalid. The error message returned because the specified NextToken parameter is invalid.
404 InvalidFileSystem.NotFound The specified file system does not exist. The error message returned because the specified file system does not exist.
404 InvalidParameter.PathNotExist The specified path does not exist. The error message returned because the specified path does not exist.

For a list of error codes, visit the API Error Center.