Closed JosephG9848949 closed 3 years ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Wmengmsft, @MehaKaushik, @shurd, @anfeldma-ms
@JosephG9848949
Get-AzStorageFile without specific file path, is to list files. Per the rest doc, list files won't return LastModified, get single file properties will return LastModified.
So you can list the files, then get properties on them one by one to get the LastModified, like following script:
# list files directly in a share
$files = Get-AzStorageFile -ShareName $containerName -Context $ctx | ? {$_.GetType().Name -eq "AzureStorageFile"}
# get file properties of each list out file
foreach ( $f in $files)
{
Get-AzStorageFile -ShareName $containerName -Path $f.Name -Context $ctx | select Name,LastModified
}
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.
Author: | JosephG9848949 |
---|---|
Assignees: | - |
Labels: | `Service Attention`, `Storage`, `customer-reported`, `needs-triage`, `question` |
Milestone: | - |
You can now use the List API to pull back timestamps including last modified time.
For the new List File API , we have plan to integrate it into Powershell.
Hello, i am trying to exeport csv file with all my storage files hosted in Azure SMB share. i am able to export all informations (Name of Directory, FileName, Size) but the lastModified is empty. when i check in the Azure GUI the last modified is not empty but with my powershell script it is empty. FYI the same powershell script was ok in past but now i have this lastmodified issue Thank you for helps.
foreach($directory in $directories)
{
#write-host -ForegroundColor Magenta " Directory Name: " $directory.Name
$files=Get-AZStorageFile -Context $ctx -ShareName $fileShareName -Path $directory.Name | Get-AZStorageFile
$files.properties
## Loop through all files and display
foreach ($file in $files)
{ #$file.fetchattributes()
# Ajouter les détails du fichier au tableau
$fileDetails += [PSCustomObject]@{
'Directory' = $directory.Name
'FileName' = $file.Name
'Size(in GB)' = "{0:N2}" -f ($file.Length / 1GB)
'LastModified' = $file.LastModified
'Username' = ($directory.Name).Split("-S")[0]
}
@larouna
Please check if you are using the latest Az.Storage (run Get-Module after repro the issue and check Az.Storage version). If not, please install the latest Az.Storage and retry.
BTW, the script sample from you looks has some error and can't pass running. (like missing '}')
Description
Steps to reproduce
Environment data
Module versions
Debug output
Error output