Get-AzDataLakeGen2ChildItem
语法
Default (默认值)
Get-AzDataLakeGen2ChildItem
[-FileSystem] <String>
[[-Path] <String>]
[-FetchProperty]
[-Recurse]
[-MaxCount <Int32>]
[-ContinuationToken <String>]
[-AsJob]
[-OutputUserPrincipalName]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
Get-AzDataLakeGen2ChildItem cmdlet 列出 Azure 存储帐户中目录或文件系统中的子目录和文件。
仅当为存储帐户启用了分层命名空间时,此 cmdlet 才有效。 可以使用“-EnableHierarchicalNamespace $true”运行“New-AzStorageAccount”cmdlet 来创建此类帐户。
示例
示例 1:列出文件系统中的直接子项
Get-AzDataLakeGen2ChildItem -FileSystem "filesystem1"
FileSystem Name: filesystem1
Path IsDirectory Length LastModified Permissions Owner Group
---- ----------- ------ ------------ ----------- ----- -----
dir1 True 2020-03-13 13:07:34Z rwxr-x--- $superuser $superuser
dir2 True 2020-03-23 09:28:36Z rwxr-x--- $superuser $superuser
此命令列出文件系统中的直接子项
示例 2:从目录以递归方式列出,并提取 Properties/ACL
Get-AzDataLakeGen2ChildItem -FileSystem "filesystem1" -Path "dir1/" -Recurse -FetchProperty
FileSystem Name: filesystem1
Path IsDirectory Length LastModified Permissions Owner Group
---- ----------- ------ ------------ ----------- ----- -----
dir1/dir3 True 2020-03-23 09:34:31Z rwx---rwx $superuser $superuser
dir1/file1 False 1024 2020-03-23 09:29:18Z rwx---rwx $superuser $superuser
dir1/testfile_1K_0 False 1024 2020-03-23 09:29:21Z rw-r----- $superuser $superuser
此命令列出文件系统中的直接子项
示例 3:以递归方式从文件系统以多个批方式列出项
$MaxReturn = 1000
$FileSystemName = "filesystem1"
$Total = 0
$Token = $Null
do
{
$items = Get-AzDataLakeGen2ChildItem -FileSystem $FileSystemName -Recurse -MaxCount $MaxReturn -ContinuationToken $Token
$Total += $items.Count
if($items.Length -le 0) { Break;}
$Token = $items[$items.Count -1].ContinuationToken;
}
While ($null -ne $Token)
Echo "Total $Total items in Filesystem $FileSystemName"
此示例使用 MaxCount 和 ContinuationToken 参数以递归方式从多个批处理中的文件系统列出项。
小型 MaxCount 可以限制单个请求返回的项数,可能有助于防止作超时错误,并减少 PowerShell 的内存使用率。
前四个命令将值分配给在示例中要使用的变量。
第五个命令指定 Do-While 语句,该语句使用 Get-AzDataLakeGen2ChildItem cmdlet 列出项。
该语句包括存储在$Token变量中的延续标记。
$Token循环运行时更改值。
最后一个命令使用 Echo 命令显示总计。
参数
-AsJob
在后台运行 cmdlet
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Context
Azure 存储上下文对象
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-ContinuationToken
继续标记。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-FetchProperty
提取 datalake 项属性和 ACL。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-FileSystem
FileSystem 名称
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 0 |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-MaxCount
可返回的 Blob 的最大计数。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-OutputUserPrincipalName
如果指定此参数,则每个列表项的所有者和组字段中返回的用户标识值将从 Microsoft Entra 对象 ID 转换为用户主体名称。 如果未指定此参数,这些值将作为Microsoft Entra 对象 ID 返回。 请注意,组和应用程序对象 ID 不会翻译,因为它们没有唯一的友好名称。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Path
应检索的指定文件系统中的路径。
应该是一个目录,格式为“directory1/directory2/”。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 1 |
| 必需: | False |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Recurse
指示是否以递归方式获取子项。
默认值为 false。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输出