2
如何从目录中的每个文件获取日期?目录文件夹中的文件日期
let directoryContent = try fileManager.contentsOfDirectory(atPath: directoryURL.path)
这就是我如何从目录中获取文件。我发现了几个方法:
directoryContent.Contains(...)
的文件,其中的数据是旧的,然后几天 - 我怎么能检查呢?
然后;
let fileAttributes = try fileManager.attributesOfItem(atPath: directoryURL.path)
它会给我目录中的最后一个文件。
而这要以字节为单位回复日期:
for var i in 0..<directoryContent.count {
let date = directoryContent.index(after: i).description.data(using: String.Encoding.utf8)!
print(date)
}
哪一个是recive从所有文件的日期或检查目录conteins这是旧的,那么X时间特定日期的最佳途径。
在此先感谢!
这就是我一直在寻找的!谢谢 ! – yerpy