Rename-AzStorageFile
Syntax
ShareName (Default)
Rename-AzStorageFile
[-ShareName] <String>
[-SourcePath] <String>
[[-DestinationPath] <String>]
[-ContentType <String>]
[-Permission <String>]
[-DisAllowSourceTrailingDot]
[-DisAllowDestTrailingDot]
[-Force]
[-AsJob]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-IgnoreReadonly]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
FileObject
Rename-AzStorageFile
[-ShareFileClient] <ShareFileClient>
[[-DestinationPath] <String>]
[-ContentType <String>]
[-Permission <String>]
[-Force]
[-AsJob]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-IgnoreReadonly]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ShareObject
Rename-AzStorageFile
[-ShareClient] <ShareClient>
[-SourcePath] <String>
[[-DestinationPath] <String>]
[-ContentType <String>]
[-Permission <String>]
[-Force]
[-AsJob]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-IgnoreReadonly]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
DirectoryObject
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
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ContentType
Sets the MIME content type of the file.
The default type is 'application/octet-stream'.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Context
Azure Storage Context Object
Parameter properties
Type: IStorageContext
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: True
Value from pipeline by property name: True
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DestinationPath
The destination path to rename the file to.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 1
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DisAllowDestTrailingDot
Disallow trailing dot (.) to suffix destination directory and destination file names.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ShareName
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DisAllowSourceTrailingDot
Disallow trailing dot (.) to suffix source directory and source file names.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ShareName
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Force
Force to overwrite the existing file.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: 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.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: 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.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ShareClient
ShareClient indicated the share where the file would be listed.
Parameter properties
Type: ShareClient
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ShareObject
Position: 0
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: True
Value from remaining arguments: False
-ShareDirectoryClient
ShareDirectoryClient indicated the share where the file would be listed.
Parameter properties
Parameter sets
DirectoryObject
Position: 0
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: True
Value from remaining arguments: False
-ShareFileClient
Source file instance
Parameter properties
Type: ShareFileClient
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
FileObject
Position: 0
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: True
Value from remaining arguments: False
-ShareName
Name of the file share where the file would be listed.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ShareName
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SourcePath
Path to an existing file.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ShareName
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ShareObject
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DirectoryObject
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs