I've been trying to get Attributes such as File Type, Creation Date, File Size of all the items in the Document Directory.
Here is the code that I've been using, but it returns me just "NSFileTypeDirectory"
let filemgr = FileManager.default
do
{
let attribs: NSDictionary? = try filemgr.attributesOfItem(
atPath: documentDirectoryPath!) as NSDictionary
if let fileattribs = attribs
{
let type = fileattribs["NSFileType"] as! String
print("File type \(type)")
}
}
catch
{
print(error)
}
I think its returning the attributes of Document folder.