@Alhasan, Mohammad-Nour Firstly, Apologies for the delay response! I am checking on this thread with the product team .
The last modified timestamp is maintained and is not changed when files are synced.
Note the last modified time is not maintained for directories and this is covered in the FAQ: Frequently asked questions (FAQ) for Azure Files | Microsoft Learn
- Does Azure File Sync sync the LastWriteTime for directories? Why isn't the date modified timestamp on a directory updated when files within it are changed?
No, Azure File Sync doesn't sync the LastWriteTime for directories. Furthermore, Azure Files doesn't update the date modified timestamp (LastWriteTime) for directories when files within the directory are changed. This is expected behavior.
Additional information: When using Azure File Sync (AFS) to synchronize files between an on-premises Windows Server and Azure File Share, the timestamp behavior depends on the configuration and synchronization settings. Let's consider the two scenarios:
Upload from on-premises to Azure File Share:
- If you upload a file from your on-premises server to Azure File Share using Azure File Sync, the timestamp of the file will be preserved. The original timestamp of the file on the on-premises server will be retained in Azure File Share.
- By default, AFS uses the LastWriteTime attribute of the file to determine if changes have occurred. If the file's timestamp has changed on the on-premises server, AFS considers it a modification and syncs the updated version to Azure File Share.
Download from Azure File Share to on-premises:
- When AFS downloads a file from Azure File Share to the on-premises server, it updates the LastWriteTime attribute of the file on the on-premises server to match the LastWriteTime of the file in Azure File Share.
- This behavior ensures that the timestamp of the file on the on-premises server reflects the most recent modification time of the file in Azure File Share.
When copying data to Azure Files, make sure you use a copy tool that supports the necessary "fidelity" to copy attributes, timestamps, and ACLs into an Azure file share - either via SMB or REST. When using Azure copy tools such as AzCopy, it's important to use the latest version. Check the file copy tools table to get an overview of Azure copy tools to ensure you can copy all of the important metadata of a file.
Note: All changes made directly in the Azure file share (not through Azure File Sync) before the start time of the last completed enumeration (26/12/2022, 3:40:47 am) have been discovered. Cloud change enumeration runs every 24 hours. To manually initiate change detection, please see learn more at the bottom.
Please let us know if you have any further queries. I’m happy to assist you further.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.