Get-AzureStorageFile 不列出目录内容,除非我将其通过管道传输到同一个 cmdlet
Get-AzureStorageFile not listing directory contents unless I pipe it to same cmdlet
我有一个名为 myshare
的 Azure 存储共享,其结构如下:
/3.3.0.22/ReportTemplates/File1.rdl
/3.3.0.22/ReportTemplates/File2.rdl
/3.3.0.22/ReportTemplates/File3.rdl
/3.3.0.22/ReportTemplates/File4.rdl
当我尝试使用此命令列出文件时
Get-AzureStorageFile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates'
我刚得到一个列出目录本身的结果:
Directory: https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22
Type Length Name
---- ------ ----
1 ReportTemplates
添加尾随 / 没有帮助。我确定这用于列出该路径下的文件(因为我记录了包括此命令在内的半自动步骤),但仅此而已。也许这是 v1.0 的变化?
Path 参数的 documentation 说
Specifies the path of a folder. This cmdlet lists the files under the
folder that this parameter specifies.
给出的示例表明它应该有效。如果我尝试仅获取 3.3.0.22
目录的列表,则同样适用:我只得到列出 3.3.0.22
目录本身的输出。
我发现如果我将输出通过管道传输到 Get-AzureStorageFile
(即再次使用相同的 cmdlet),它会提供我所期望的结果。但这似乎不对?
get-azurestoragefile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates' | get-azurestoragefile
Directory: https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22/ReportTemplates
Type Length Name
---- ------ ----
1 File1.rdl
1 File2.rdl
1 File3.rdl
1 File4.rdl
自从我上次使用这些命令以来,我已经移动了工作站,所以可能有一些环境因素影响了这个……但我不知道那会是什么。
运行 (Get-Module -Name Azure).Version
报告版本 1.0.2.-1
运行 get-azurestoragefile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates' | select-object *
给出了下面的输出...感觉返回的是错误的类型:
ServiceClient : Microsoft.WindowsAzure.Storage.File.CloudFileClient
Uri : https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22/ReportTemplates
StorageUri : Primary = 'https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22/ReportTemplates'; Secondary = ''
Properties : Microsoft.WindowsAzure.Storage.File.FileDirectoryProperties
Metadata : {}
Share : Microsoft.WindowsAzure.Storage.File.CloudFileShare
Parent : Microsoft.WindowsAzure.Storage.File.CloudFileDirectory
Name : ReportTemplates
当前版本的 Azure Powershell cmdlet 中存在错误。
"Get-AzureStorageFile -Share $s -Path folderpath" 绝对应该 return 文件夹路径中的文件。我就此询问了 Gaurav Mantri,他查看了代码,发现该 cmdlet 正在发出 "Head" 请求以获取目录的属性,而不是获取文件。
我已经在 github 上报告了这个问题,希望它能尽快得到修复。
我有一个名为 myshare
的 Azure 存储共享,其结构如下:
/3.3.0.22/ReportTemplates/File1.rdl
/3.3.0.22/ReportTemplates/File2.rdl
/3.3.0.22/ReportTemplates/File3.rdl
/3.3.0.22/ReportTemplates/File4.rdl
当我尝试使用此命令列出文件时
Get-AzureStorageFile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates'
我刚得到一个列出目录本身的结果:
Directory: https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22
Type Length Name
---- ------ ----
1 ReportTemplates
添加尾随 / 没有帮助。我确定这用于列出该路径下的文件(因为我记录了包括此命令在内的半自动步骤),但仅此而已。也许这是 v1.0 的变化?
Path 参数的 documentation 说
Specifies the path of a folder. This cmdlet lists the files under the folder that this parameter specifies.
给出的示例表明它应该有效。如果我尝试仅获取 3.3.0.22
目录的列表,则同样适用:我只得到列出 3.3.0.22
目录本身的输出。
我发现如果我将输出通过管道传输到 Get-AzureStorageFile
(即再次使用相同的 cmdlet),它会提供我所期望的结果。但这似乎不对?
get-azurestoragefile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates' | get-azurestoragefile
Directory: https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22/ReportTemplates
Type Length Name
---- ------ ----
1 File1.rdl
1 File2.rdl
1 File3.rdl
1 File4.rdl
自从我上次使用这些命令以来,我已经移动了工作站,所以可能有一些环境因素影响了这个……但我不知道那会是什么。
运行 (Get-Module -Name Azure).Version
报告版本 1.0.2.-1
运行 get-azurestoragefile -sharename 'myshare' -Path '3.3.0.22/ReportTemplates' | select-object *
给出了下面的输出...感觉返回的是错误的类型:
ServiceClient : Microsoft.WindowsAzure.Storage.File.CloudFileClient
Uri : https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22/ReportTemplates
StorageUri : Primary = 'https://<mystorageaccount>.file.core.windows.net/myshare/3.3.0.22/ReportTemplates'; Secondary = ''
Properties : Microsoft.WindowsAzure.Storage.File.FileDirectoryProperties
Metadata : {}
Share : Microsoft.WindowsAzure.Storage.File.CloudFileShare
Parent : Microsoft.WindowsAzure.Storage.File.CloudFileDirectory
Name : ReportTemplates
当前版本的 Azure Powershell cmdlet 中存在错误。 "Get-AzureStorageFile -Share $s -Path folderpath" 绝对应该 return 文件夹路径中的文件。我就此询问了 Gaurav Mantri,他查看了代码,发现该 cmdlet 正在发出 "Head" 请求以获取目录的属性,而不是获取文件。
我已经在 github 上报告了这个问题,希望它能尽快得到修复。