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)")


Find answers here

Hi there! Ask Us a Question We are ready to help