你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Move-AzDataLakeGen2Item
将文件或目录移到同一存储帐户中的另一个文件或目录。
语法
Move-AzDataLakeGen2Item
[-FileSystem] <String>
[-Path] <String>
-DestFileSystem <String>
-DestPath <String>
[-Force]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Move-AzDataLakeGen2Item
-InputObject <AzureDataLakeGen2Item>
-DestFileSystem <String>
-DestPath <String>
[-Force]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Move-AzDataLakeGen2Item cmdlet 将文件或目录移到同一存储帐户中的另一个文件或目录。 仅当为存储帐户启用了分层命名空间时,此 cmdlet 才有效。 可以使用“-EnableHierarchicalNamespace $true”运行“New-AzStorageAccount”cmdlet 来创建此类帐户。
示例
示例 1:在同一文件系统中移动折叠
Move-AzDataLakeGen2Item -FileSystem "filesystem1" -Path "dir1/" -DestFileSystem "filesystem1" -DestPath "dir3/"
FileSystem Name: filesystem1
Path IsDirectory Length LastModified Permissions Owner Group
---- ----------- ------ ------------ ----------- ----- -----
dir3 True 2020-03-13 13:07:34Z rwxrw-rw- $superuser $superuser
此命令将目录“dir1”移动到同一文件系统中的目录“dir3”。
示例 2:按管道将文件移到同一存储帐户中的另一个文件系统,而不提示
Get-AzDataLakeGen2Item -FileSystem "filesystem1" -Path "dir1/file1" | Move-AzDataLakeGen2Item -DestFileSystem "filesystem2" -DestPath "dir2/file2" -Force
FileSystem Name: filesystem2
Path IsDirectory Length LastModified Permissions Owner Group
---- ----------- ------ ------------ ----------- ----- -----
dir2/file2 False 1024 2020-03-23 09:57:33Z rwxrw-rw- $superuser $superuser
此命令将“filesystem1/file1”中的文件“dir1/file1”移动到同一存储帐户中“filesystem2”中的“dir2/file2”,而不提示。
示例 3:使用 Sas 令牌移动项
$sas = New-AzStorageContainerSASToken -Name $filesystemName -Permission rdw -Context $ctx
$sasctx = New-AzStorageContext -StorageAccountName $ctx.StorageAccountName -SasToken $sas
Move-AzDataLakeGen2Item -FileSystem $filesystemName -Path $itempath1 -DestFileSystem $filesystemName -DestPath "$($itempath2)$($sas)" -Context $sasctx
FileSystem Name: filesystem1
Path IsDirectory Length LastModified Permissions Owner Group
---- ----------- ------ ------------ ----------- ----- -----
dir2/file1 False 1024 2021-03-23 09:57:33Z rwxrw-rw- $superuser $superuser
第一个命令创建具有 rdw 权限的 Sas 令牌,第二个命令从 Sas 令牌创建存储上下文,第三个命令使用 Sas 令牌移动项。 此示例将同一 Sastoken 与对源和析构的 rdw 权限一起使用,如果对源和析构使用 2 个 SAS 令牌,则源需要权限 rd,destication 需要权限 w。
参数
-Confirm
在运行 cmdlet 之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Context
Azure 存储上下文对象
类型: | IStorageContext |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
类型: | IAzureContextContainer |
别名: | AzureRmContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DestFileSystem
Dest FileSystem 名称
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-DestPath
Dest Blob 路径
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-FileSystem
FileSystem 名称
类型: | String |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Force
强制重写写入目标。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-InputObject
要从中移动的 Azure Datalake Gen2 项对象。
类型: | AzureDataLakeGen2Item |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Path
应从中移动的指定文件系统中的路径。 可以是文件或目录,格式为“directory/file.txt”或“directory1/directory2/”
类型: | String |
Position: | 1 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |