Timestamp of AFS Sync behavior

Alhasan, Mohammad-Nour 40 Reputation points
2023-07-14T11:53:48.83+00:00

Hello all,

i have a costumer who has data that are sensitive to the metadata timestamp. He has asked us about the behavior of the sync of the data accourding to the timestamp.

My Question is:

How does the AFS Mechanism handle with the timestamp in every download und upload? Does the timestamp still the same or it changes the timestamp of the file in every sync?

Thanks in advance!

Kind regards
Mohammad Alhasan

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,115 questions
Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,281 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sumarigo-MSFT 42,761 Reputation points Microsoft Employee
    2023-07-17T08:54:07.73+00:00

    @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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful