0

我需要获取目录中特定时间段内创建的文件列表,例如在 19:14 和 23:11 之前创建的文件。每个目录都包含属于特定日期(24 小时)的文件。我应该在其名称中包含每个文件的创建时间吗?(如prefix-hh-mm-ss-ms.txt)。这些文件是要从另一个地方复制到目录的,所以我担心复制可能会修改文件的创建时间,我不应该依赖它。任何向我展示实现我想做的最佳方式的建议将不胜感激。

4

1 回答 1

1

Copying should not "modify" the creation time; since the destination file was actually only created at copying time, isn't it only logical that the creation time of the copied file is the time when the copying occured?

The file creation time is however not really available under linux anyway (see the question you linked yourself How to get 'file creation time' in Linux, or https://superuser.com/questions/437663/whats-an-elegant-way-to-copy-the-creation-and-modification-dates-of-a-file-to-a).

So you'll have to encode that in some other way anyway. Encoding it in the filename as you suggest sounds like a reasonable way!

于 2013-08-21T07:15:55.887 回答