你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Rename-AzStorageFile
重命名文件。
语法
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>]
说明
Rename-AzStorageFile cmdlet 从文件共享重命名目录。
示例
示例 1:从文件共享重命名文件
Rename-AzStorageFile -SourcePath testfile1 -DestinationPath testfile2 -ShareName myshare
AccountName: myaccount, ShareName: myshare
Type Length Name
---- ------ ----
File 512 testfile2
此命令将 testfile1 中的文件重命名为文件共享 myshare 下的 testfile2。
示例 2:使用管道从文件共享重命名文件
Get-AzStorageFile -ShareName myshare -Path testfile1 | Rename-AzStorageFile -DestinationPath testfile2
AccountName: myaccount, ShareName: myshare
Type Length Name
---- ------ ----
File 512 testfile2
此命令首先获取文件客户端对象,并使用管道将文件从 testfile1 重命名为 testfile2。
参数
-AsJob
在后台运行 cmdlet
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-ContentType
设置文件的 MIME 内容类型。 默认类型为“application/octet-stream”。
类型: | String |
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 |
-DestinationPath
要重命名文件的目标路径。
类型: | String |
Position: | 1 |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DisAllowDestTrailingDot
禁止尾随点 (.) 后缀目标目录和目标文件名。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DisAllowSourceTrailingDot
禁止尾随点 (.) 以后缀源目录和源文件名称。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Force
强制覆盖现有文件。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-IgnoreReadonly
自选。 指定是否应尊重预先存在的目标文件上的 ReadOnly 属性。 如果为 true,则重命名将成功,否则,目标上一个具有 ReadOnly 属性集的文件将导致重命名失败。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Permission
如果指定了权限(安全描述符),则应为目录/文件设置权限。 默认值:继承。 如果将 SDDL 指定为输入,则它必须具有所有者、组和 dacl。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-ShareClient
ShareClient 指示将列出文件的共享。
类型: | ShareClient |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ShareDirectoryClient
ShareDirectoryClient 指示要列出文件的共享。
类型: | ShareDirectoryClient |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ShareFileClient
源文件实例
类型: | ShareFileClient |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ShareName
要在其中列出文件的文件共享的名称。
类型: | String |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-SourcePath
现有文件的路径。
类型: | String |
Position: | 1 |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |