Skip to main content

directory

Creates, updates, deletes, gets or lists a directory resource.

Overview

Namedirectory
TypeResource
Idazure.storage_file_share.directory

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
DirectoryIdstring:vartype directory_id: str
DirectoryPathstringRequired.
Encodedboolean:vartype encoded: bool
Markerstring:vartype marker: str
MaxResultsinteger:vartype max_results: int
NextMarkerstringRequired.
PrefixobjectRequired.
SegmentobjectAbstract for entries that can be listed from Directory. Required.
ServiceEndpointstringRequired.
ShareNamestringRequired.
ShareSnapshotstring:vartype share_snapshot: str

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_files_and_directories_segmentselectx-ms-version, accountprefix, sharesnapshot, marker, maxresults, timeout, include, x-ms-file-extended-info, x-ms-allow-trailing-dot, x-ms-file-request-intentReturns 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.
createinsertx-ms-version, accounttimeout, x-ms-meta, x-ms-file-permission, x-ms-file-permission-format, x-ms-file-permission-key, x-ms-file-attributes, x-ms-file-creation-time, x-ms-file-last-write-time, x-ms-file-change-time, x-ms-owner, x-ms-group, x-ms-mode, x-ms-file-property-semantics, x-ms-allow-trailing-dot, x-ms-file-request-intentCreates a new directory under the specified share or parent directory.
deletedeletex-ms-version, accounttimeout, x-ms-allow-trailing-dot, x-ms-file-request-intentRemoves the specified empty directory. Note that the directory must be empty before it can be deleted.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
accountstringStorage account name. (default: )
x-ms-versionstring
includearrayInclude this parameter to specify one or more datasets to include in the response. Default value is None.
markerstringA 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. Default value is None.
maxresultsintegerSpecifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 items. Default value is None.
prefixstringFilters the results to return only entries whose name begins with the specified prefix. Default value is None.
sharesnapshotstringThe snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. Default value is None.
timeoutintegerThe timeout parameter is expressed in seconds. For more information, see
x-ms-allow-trailing-dotboolean
x-ms-file-attributesstringIf specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. Default value is "none".
x-ms-file-change-timestringChange time for the file/directory. Default value: Now. Default value is None.
x-ms-file-creation-timestringCreation time for the file/directory. Default value: Now. Default value is "now".
x-ms-file-extended-infobooleanInclude extended information. Default value is None.
x-ms-file-last-write-timestringLast write time for the file/directory. Default value: Now. Default value is "now".
x-ms-file-permissionstringIf specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit".
x-ms-file-permission-formatstringOptional. Available for version 2023-06-01 and later. Specifies the format in which the permission is returned. Acceptable values are SDDL or binary. If x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the permission is returned as a base64 string representing the binary encoding of the permission. Known values are: "Sddl" and "Binary". Default value is None.
x-ms-file-permission-keystringKey of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None.
x-ms-file-property-semanticsstringSMB only, default value is New. New will forcefully add the ARCHIVE attribute flag and alter the permissions specified in x-ms-file-permission to inherit missing permissions from the parent. Restore will apply changes without further modification. Known values are: "New" and "Restore". Default value is None.
x-ms-file-request-intentstring
x-ms-groupstringOptional, NFS only. The owning group of the file or directory. Default value is None.
x-ms-metaobjectA name-value pair to associate with a file storage object. Default value is None.
x-ms-modestringOptional, NFS only. The file mode of the file or directory. Default value is None.
x-ms-ownerstringOptional, NFS only. The owner of the file or directory. Default value is None.

SELECT examples

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.

SELECT
DirectoryId,
DirectoryPath,
Encoded,
Marker,
MaxResults,
NextMarker,
Prefix,
Segment,
ServiceEndpoint,
ShareName,
ShareSnapshot
FROM azure.storage_file_share.directory
WHERE x-ms-version = '{{ x-ms-version }}' -- required
AND account = '{{ account }}' -- required
AND prefix = '{{ prefix }}'
AND sharesnapshot = '{{ sharesnapshot }}'
AND marker = '{{ marker }}'
AND maxresults = '{{ maxresults }}'
AND timeout = '{{ timeout }}'
AND include = '{{ include }}'
AND x-ms-file-extended-info = '{{ x-ms-file-extended-info }}'
AND x-ms-allow-trailing-dot = '{{ x-ms-allow-trailing-dot }}'
AND x-ms-file-request-intent = '{{ x-ms-file-request-intent }}'
;

INSERT examples

Creates a new directory under the specified share or parent directory.

INSERT INTO azure.storage_file_share.directory (
x-ms-version,
account,
timeout,
x-ms-meta,
x-ms-file-permission,
x-ms-file-permission-format,
x-ms-file-permission-key,
x-ms-file-attributes,
x-ms-file-creation-time,
x-ms-file-last-write-time,
x-ms-file-change-time,
x-ms-owner,
x-ms-group,
x-ms-mode,
x-ms-file-property-semantics,
x-ms-allow-trailing-dot,
x-ms-file-request-intent
)
SELECT
'{{ x-ms-version }}',
'{{ account }}',
'{{ timeout }}',
'{{ x-ms-meta }}',
'{{ x-ms-file-permission }}',
'{{ x-ms-file-permission-format }}',
'{{ x-ms-file-permission-key }}',
'{{ x-ms-file-attributes }}',
'{{ x-ms-file-creation-time }}',
'{{ x-ms-file-last-write-time }}',
'{{ x-ms-file-change-time }}',
'{{ x-ms-owner }}',
'{{ x-ms-group }}',
'{{ x-ms-mode }}',
'{{ x-ms-file-property-semantics }}',
'{{ x-ms-allow-trailing-dot }}',
'{{ x-ms-file-request-intent }}'
;

DELETE examples

Removes the specified empty directory. Note that the directory must be empty before it can be deleted.

DELETE FROM azure.storage_file_share.directory
WHERE x-ms-version = '{{ x-ms-version }}' --required
AND account = '{{ account }}' --required
AND timeout = '{{ timeout }}'
AND x-ms-allow-trailing-dot = '{{ x-ms-allow-trailing-dot }}'
AND x-ms-file-request-intent = '{{ x-ms-file-request-intent }}'
;