To return the filename and last modified date of files in an Azure file share, you can use Azure PowerShell or Azure CLI. Here's an example using Azure PowerShell:
- Install the Azure PowerShell module if you haven't already done so. You can find instructions here.
- Connect to your Azure account using
Connect-AzAccount
. - Get the storage account context using
Get-AzStorageAccount
. - Get the file share using
Get-AzStorageShare
. - Get the files in the file share using
Get-AzStorageFile
. - Select the properties you want to display using
Select-Object
.
Here's an example PowerShell script that returns the filename and last modified date of all files in a file share:
# Connect to your Azure account
Connect-AzAccount
# Get the storage account context
$ctx = Get-AzStorageAccount -ResourceGroupName <resource-group-name> -Name <storage-account-name>
# Get the file share
$share = Get-AzStorageShare -Context $ctx -Name <file-share-name>
# Get the files in the file share and select the properties you want to display
Get-AzStorageFile -Context $ctx -ShareName $share.Name -Path <path-to-files> | Select-Object Name, LastModified
Replace <resource-group-name>
, <storage-account-name>
, <file-share-name>
, and <path-to-files>
with the appropriate values for your environment.
References: