Search code examples
objective-ciosdatexcode4nsdocumentdirectory

Creation date of files in NSDocumentDirectory


I need to do the following: create an array with filenames and creation dates from files online compare this array with an array of filenames and creation dates from files in the NSDocumentDirectory.

How can I read the creation date from files in the NSDocumentDirectory?


Solution

  • You can use - (NSDictionary *)attributesOfItemAtPath:(NSString *)path error:(NSError **)error method from NSFileManager.

    You can get the file modification date with NSFileModificationDate from the dictionary received by above method.