在Azure文件存储中存储文件创建日期 [英] Storing file created date in Azure File Storage

查看:51
本文介绍了在Azure文件存储中存储文件创建日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一系列Excel文件存储在我公司的Azure文件存储容器中.我的经理希望能够看到这些文件的文件创建日期,因为我们将每月运行相同报告的下载.有没有一种方法可以自动将创建的日期存储为Azure中的属性之一,或者添加一些自定义元数据呢?预先感谢.

I am storing a series of Excel files in an Azure File Storage container for my company. My manager wants to be able to see the file created date for these files, as we will be running monthly downloads of the same reports. Is there a way to automate a means of storing the created date as one of the properties in Azure, or adding a bit of custom metadata, perhaps? Thanks in advance.

推荐答案

您当然可以将创建的日期存储为文件的自定义元数据的一部分.但是,您需要注意某些事项:

You can certainly store the created date as part of custom metadata for the file. However, there are certain things you would need to be aware of:

  • 元数据是可编辑的:有权访问存储帐户的任何人都可以编辑元数据.他们可以更改创建的日期元数据值,甚至删除该信息.
  • 查询很麻烦:Azure文件存储不提供查询功能,因此,如果要查询文件的创建日期,这将是一个痛苦的过程.首先,您需要列出共享中的所有文件,然后分别获取每个文件的元数据.根据文件数量和嵌套级别,这可能是一个复杂的过程.
  • Metadata is editable: Anybody with access to the storage account can edit the metadata. They can change the created date metadata value or even delete that information.
  • Querying is painful: Azure File Storage doesn't provide querying capability so if you want to query on file's created date, it is going to be a painful process. First you would need to list all files in a share and then fetch metadata for each file separately. Depending on the number of files and the level of nesting, it could be a complicated process.

有一些可供选择的选择:

There are some alternatives available to you:

使用Blob存储

如果可以使用Blob存储代替文件存储,请使用它.Blob存储具有用于创建日期的系统定义的属性,因此您无需执行任何特殊操作.但是,与文件存储一样,Blob存储在查询方面也存在问题,但相对而言,痛苦较小.

If you can use Blob Storage instead of File Storage, use that. Blob Storage has a system defined property for created date so you don't have to do anything special. However like File Storage, Blob Storage also has an issue with querying but it is comparatively less painful.

使用表存储/SQL数据库进行报告

出于查询目的,可以将文件的创建日期存储在Azure表存储或SQL数据库中.这种方法的缺点是,因为它是一个完全独立的系统,所以您有责任保持数据同步.例如,如果文件被删除,则需要确保数据库中相同文件的条目也被删除.

For querying purposes, you can store the file's created date in either Azure Table Storage or SQL Database. The downside of this approach is that because it is a completely separate system, it would be your responsibility to keep the data in sync. For example, if a file is deleted, you will need to ensure that entry for the same in the database is also removed.

这篇关于在Azure文件存储中存储文件创建日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆