简体   繁体   English

使用StartCopyAsync C#Azure文件共享时如何保留上次修改日期

[英]How to Keep Last Modified Date when using StartCopyAsync C# Azure File Share

I'm trying to copy files from one location on a fileshare into another location. 我正在尝试将文件从文件共享上的一个位置复制到另一位置。 I'm fetching attributes and then using startcopyasync. 我正在获取属性,然后使用startcopyasync。 The metadata persists but the last modified date and etag change. 元数据仍然存在,但最后修改的日期和etag更改。

StartCopy says it copies metadata and properties but it seems like it only copies metadata to me. StartCopy表示它复制元数据和属性,但似乎只复制元数据给我。

var currentFile = srcDir.GetFileReference(((CloudFile) item).Name);
currentFile.FetchAttributes();
var destFile = destDir.GetFileReference(((CloudFile) item).Name);                       
await destFile.StartCopyAsync(currentFile);

Does it not actually copy lastmodified date? 它实际上不复制上次修改的日期吗? Am I doing something wrong? 难道我做错了什么? I can't find good documentation on this exact situation. 我找不到关于这种确切情况的好的文档。

Refer to the suggestion mentioned in the below mentioned links Storing file created date in Azure File Storage 请参阅以下链接中提到的建议在Azure文件存储中存储文件创建日期

Getting the latest file modified from Azure Blob 从Azure Blob修改最新文件

Kindly let us know if the above helps or you need further assistance on this issue. 请让我们知道以上内容是否对您有帮助,或者您需要在此问题上进一步的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM