你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Rename-AzStorageFile
Renames a file.
Syntax
Rename-AzStorageFile
[-ShareName] <String>
[-SourcePath] <String>
[[-DestinationPath] <String>]
[-ContentType <String>]
[-Permission <String>]
[-DisAllowSourceTrailingDot]
[-DisAllowDestTrailingDot]
[-Force]
[-AsJob]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-IgnoreReadonly]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Rename-AzStorageFile
[-ShareFileClient] <ShareFileClient>
[[-DestinationPath] <String>]
[-ContentType <String>]
[-Permission <String>]
[-Force]
[-AsJob]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-IgnoreReadonly]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Rename-AzStorageFile
[-ShareClient] <ShareClient>
[-SourcePath] <String>
[[-DestinationPath] <String>]
[-ContentType <String>]
[-Permission <String>]
[-Force]
[-AsJob]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-IgnoreReadonly]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Rename-AzStorageFile
[-ShareDirectoryClient] <ShareDirectoryClient>
[-SourcePath] <String>
[[-DestinationPath] <String>]
[-ContentType <String>]
[-Permission <String>]
[-Force]
[-AsJob]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-IgnoreReadonly]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Rename-AzStorageFile cmdlet renames a directory from a file share.
Examples
Example 1 : Rename a file from a file share
Rename-AzStorageFile -SourcePath testfile1 -DestinationPath testfile2 -ShareName myshare
AccountName: myaccount, ShareName: myshare
Type Length Name
---- ------ ----
File 512 testfile2
This command renames a file from testfile1 to testfile2 under file share myshare.
Example 2 : Rename a file from a file share using pipeline
Get-AzStorageFile -ShareName myshare -Path testfile1 | Rename-AzStorageFile -DestinationPath testfile2
AccountName: myaccount, ShareName: myshare
Type Length Name
---- ------ ----
File 512 testfile2
This command gets a file client object first, and the rename the file from testfile1 to testfile2 using pipeline.
Parameters
-AsJob
Run cmdlet in the background
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
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 |
-ContentType
Sets the MIME content type of the file. The default type is 'application/octet-stream'.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Context
Azure Storage Context Object
Type: | IStorageContext |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DefaultProfile
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 |
-DestinationPath
The destination path to rename the file to.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisAllowDestTrailingDot
Disallow trailing dot (.) to suffix destination directory and destination file names.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisAllowSourceTrailingDot
Disallow trailing dot (.) to suffix source directory and source file names.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Force
Force to overwrite the existing file.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-IgnoreReadonly
Optional. Specifies whether the ReadOnly attribute on a preexisting destination file should be respected. If true, the rename will succeed, otherwise, a previous file at the destination with the ReadOnly attribute set will cause the rename to fail.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Permission
If specified the permission (security descriptor) shall be set for the directory/file. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ShareClient
ShareClient indicated the share where the file would be listed.
Type: | ShareClient |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ShareDirectoryClient
ShareDirectoryClient indicated the share where the file would be listed.
Type: | ShareDirectoryClient |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ShareFileClient
Source file instance
Type: | ShareFileClient |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ShareName
Name of the file share where the file would be listed.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SourcePath
Path to an existing file.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
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 |