iphone - How to get name and creation date of all files in a folder in ios? -



iphone - How to get name and creation date of all files in a folder in ios? -

i using next code creation date of file @ given path , works fine.

nsdictionary* attrs = [fm attributesofitematpath:@"/users/me/desktop/ios" error:nil]; if (attrs != nil) { nsdate *date = (nsdate*)[attrs objectforkey: nsfilecreationdate]; nslog(@"date created: %@", [date description]); } else { nslog(@"not found"); }

now want names , creation dates of files in folder given @ path.how can that? can help me?

first list of files directory & loop until file completes

nsstring *bundleroot = [[nsbundle mainbundle] bundlepath]; nsfilemanager *fm = [nsfilemanager defaultmanager]; nsarray *dircontents = [fm contentsofdirectoryatpath:bundleroot error:nil]; for(int i=0;i<[dircontents count];i++) { nsdictionary* attrs = [fm attributesofitematpath:[dircontents objectatindex:i] error:nil]; if (attrs != nil) { nsdate *date = (nsdate*)[attrs objectforkey: nsfilecreationdate]; nslog(@"date created: %@", [date description]); } else { nslog(@"not found"); } }

iphone ios xcode jailbreak

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -