Get attributes of file


I want to get the attributes of a files, at given location: creation date, file type, owner, etc.


// Create a FileManager instance

let fileManager = NSFileManager.defaultManager()

// Get attributes of 'myfile.txt' file

do {
    let attributes = try fileManager.attributesOfItemAtPath("myfile.txt")
catch let error as NSError {
    print("Ooops! Something went wrong: \(error)")

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)