List Directories and Files operation returns a list of files or directories under the specified share or directory. It lists the contents only for a single level of the directory hierarchy.
List Directories and Files request may be constructed as follows. HTTPS is recommended.
|Method||Request URI||HTTP Version|
Replace the path components shown in the request URI with your own, as follows:
|myaccount||The name of your storage account.|
|myshare||The name of your file share.|
|mydirectorypath||The path to the directory.|
For details on path naming restrictions, see Naming and Referencing Shares, Directories, Files, and Metadata.
The following additional parameters may be specified on the URI.
||Optional. Version 2016-05-31 and newer. Filters the results to return only files and directories whose name begins with the specified prefix.|
||Optional. A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items.
The marker value is opaque to the client.
||Optional. Specifies the maximum number of files and/or directories to return. If the request does not specify
The following table describes required and optional request headers.
||Required. Specifies the authentication scheme, account name, and signature. For more information, see Authentication for the Azure Storage Services.|
||Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authentication for the Azure Storage Services.|
||Required for all authenticated requests, optional for anonymous requests. Specifies the version of the operation to use for this request. For more information, see Versioning for the Azure Storage Services.|
The response includes an HTTP status code, a set of response headers, and a response body in XML format.
A successful operation returns status code 200 (OK).
For information about status codes, see Status and Error Codes.
The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.
||Specifies the format in which the results are returned. Currently this value is
||This header uniquely identifies the request that was made and can be used for troubleshooting the request. For more information, see Troubleshooting API Operations.|
||Indicates the version of the File service used to execute the request.|
||A UTC date/time value generated by the service that indicates the time at which the response was initiated.|
The format of the XML response is as follows.
Note that the
MaxResults elements are present only if they were specified on the request URI. The
NextMarker element has a value only if the list results are not complete.
<?xml version="1.0" encoding="utf-8"?> <EnumerationResults ServiceEndpoint="https://myaccount.file.core.windows.net/” ShareName="myshare" DirectoryPath="directory-path"> <Marker>string-value</Marker> <MaxResults>int-value</MaxResults> <Prefix>prefix-value</Prefix> <Entries> <File> <Name>file-name</Name> <Properties> <Content-Length>size-in-bytes</Content-Length> </Properties> </File> <Directory> <Name>directory-name</Name> </Directory> </Entries> <NextMarker /> </EnumerationResults>
Note that the
Content-Length element is returned in the listing. However, this value may not be up-to-date since an SMB client may have modified the file locally. The value of
Content-Length may not reflect that fact until the handle is closed or the op-lock is broken. To retrieve current property values, call Get File Properties.
Only the account owner may call this operation.
The value returned in the
Content-Length element corresponds to the value of the file’s
Note that each
Directory element returned counts toward the maximum result, just as each
File element does. Files and directories are listed intermingled in lexically sorted order in the response body.
Listing is limited to a single level of the directory hierarchy. In order to list multiple levels, you can make multiple calls in an iterative manner by using the
Directory value returned from one result in a subsequent call to
List Directories and Files.