Move-AzDataLakeGen2Item
Move a file or directory to another a file or directory in same Storage account.
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>]
The Move-AzDataLakeGen2Item cmdlet moves a a file or directory to another a file or directory in same Storage account. This cmdlet only works if Hierarchical Namespace is enabled for the Storage account. This kind of account can be created by run "New-AzStorageAccount" cmdlet with "-EnableHierarchicalNamespace $true".
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
This command move directory 'dir1' to directory 'dir3' in the same Filesystem.
Example 2: Move a file by pipeline, to another Filesystem in the same Storage account without prompt
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
This command move file 'dir1/file1' in 'filesystem1' to file 'dir2/file2' in 'filesystem2' in the same Storage account without prompt.
$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
This first command creates a Sas token with rdw permission, the second command creates a Storage context from the Sas token, the 3rd command moves an item with the Sas token. This example use same Sastoken with rdw permission on both source and destication, if use 2 SAS token for source and destication, source need permission rd, destication need permission w.
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Azure Storage Context Object
Type: | IStorageContext |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Dest FileSystem name
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Dest Blob path
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
FileSystem name
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Force to over write the destination.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Azure Datalake Gen2 Item Object to move from.
Type: | AzureDataLakeGen2Item |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
The path in the specified Filesystem that should be move from. Can be a file or directory In the format 'directory/file.txt' or 'directory1/directory2/'
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |