iphone Programming Glossary: contentsofdirectoryatpath
Get directory contents in date modified order http://stackoverflow.com/questions/1523793/get-directory-contents-in-date-modified-order NSString documentsPath searchPaths objectAtIndex 0 NSError error nil NSArray filesArray NSFileManager defaultManager contentsOfDirectoryAtPath documentsPath error &error if error nil NSLog @ Error in reading files @ error localizedDescription return sort by creation..
iPhone (iOS): copying files from main bundle to documents folder error http://stackoverflow.com/questions/3246109/iphone-ios-copying-files-from-main-bundle-to-documents-folder-error you can use NSArray's enumerateObjectsUsingBlock function for that NSArray resContents NSFileManager defaultManager contentsOfDirectoryAtPath copyItemAtPath sourcePath error NULL resContents enumerateObjectsUsingBlock ^ id obj NSUInteger idx BOOL stop NSError error.. P.S. If you can't use blocks you can use fast enumeration NSArray resContents NSFileManager defaultManager contentsOfDirectoryAtPath copyItemAtPath sourcePath error NULL for NSString obj in resContents NSError error if NSFileManager defaultManager copyItemAtPath..
How To Use the CHCSVParser class http://stackoverflow.com/questions/3788295/how-to-use-the-chcsvparser-class paths objectAtIndex 0 NSFileManager manager NSFileManager defaultManager NSError err nil NSArray fileList manager contentsOfDirectoryAtPath documentsDirectory error err NSString fileName fileList objectAtIndex 1 NSURL inputFileURL NSURL fileURLWithPath documentsDirectory..
iphone copying folder from bundle to documents http://stackoverflow.com/questions/4053618/iphone-copying-folder-from-bundle-to-documents @ 12 NSLog @ @ myPath returns .... MyApp.app 12 NSArray arrayOf12s NSFileManager defaultManager contentsOfDirectoryAtPath myPath error nil NSLog @ @ arrayOf12s always returns NULL iphone nsfilemanager nsbundle share improve this question .. returns NULL iphone nsfilemanager nsbundle share improve this question How about using the NSError argument in contentsOfDirectoryAtPath error call NSString myPath NSBundle mainBundle resourcePath stringByAppendingPathComponent @ 12 NSLog @ @ myPath returns.. @ 12 NSLog @ @ myPath returns .... MyApp 12 NSError error nil NSArray arrayOf12s NSFileManager defaultManager contentsOfDirectoryAtPath resourceDBFolderPath error error if error NSLog @ Error @ error localizedDescription NSLog @ @ arrayOf12s always returns..
How to rename directories? http://stackoverflow.com/questions/4486979/how-to-rename-directories oldDirectoryPath @ Type your old directory Path NSArray tempArrayForContentsOfDirectory NSFileManager defaultManager contentsOfDirectoryAtPath oldDirectoryPath error nil NSString newDirectoryPath oldDirectoryPath stringByDeletingLastPathComponent stringByAppendingPathComponent..
Deleting all the files in the iPhone sandbox (documents folder)? http://stackoverflow.com/questions/4793278/deleting-all-the-files-in-the-iphone-sandbox-documents-folder NSFileManager fileMgr NSFileManager alloc init autorelease NSError error nil NSArray directoryContents fileMgr contentsOfDirectoryAtPath documentsDirectory error error if error nil for NSString path in directoryContents NSString fullPath documentsDirectory..
Getting a list of files in a directory with a glob http://stackoverflow.com/questions/499673/getting-a-list-of-files-in-a-directory-with-a-glob bundleRoot NSBundle mainBundle bundlePath NSFileManager fm NSFileManager defaultManager NSArray dirContents fm contentsOfDirectoryAtPath bundleRoot error nil NSPredicate fltr NSPredicate predicateWithFormat @ self ENDSWITH '.jpg' NSArray onlyJPGs dirContents..
NSPredicate endswith multiple files http://stackoverflow.com/questions/5032541/nspredicate-endswith-multiple-files I do it Would something close to 'self endswith in @' work Thanks NSArray dirContents NSFileManager defaultManager contentsOfDirectoryAtPath documentsDirectoryPath error nil NSArray files dirContents filteredArrayUsingPredicate NSPredicate predicateWithFormat @.. NSArray arrayWithObjects @ mp4 @ mov @ m4v @ pdf @ doc @ xls nil NSArray dirContents NSFileManager defaultManager contentsOfDirectoryAtPath documentsDirectoryPath error nil NSArray files dirContents filteredArrayUsingPredicate NSPredicate predicateWithFormat @..
Make movie file with picture Array and song file, using AVAsset http://stackoverflow.com/questions/6061092/make-movie-file-with-picture-array-and-song-file-using-avasset NSDocumentDirectory NSUserDomainMask YES objectAtIndex 0 NSArray dirContents NSFileManager defaultManager contentsOfDirectoryAtPath documentsDirectoryPath error nil for NSString tString in dirContents if tString isEqualToString @ essai.mp4 NSFileManager..
Read/write file in Documents directory problem http://stackoverflow.com/questions/6496454/read-write-file-in-documents-directory-problem 5731 707 Text file data null If I try this it also prints out null NSLog @ My Documents @ NSFileManager defaultManager contentsOfDirectoryAtPath documentsDirectory error NULL What have I missed or am I doing wrong while writing to this file Might it be something I..
Problem with CGImageDestination and file naming http://stackoverflow.com/questions/7301718/problem-with-cgimagedestination-and-file-naming destination CFRelease destination TEST OUTPUT GENERATED FILES NSArray contents NSFileManager defaultManager contentsOfDirectoryAtPath NSSearchPathForDirectoriesInDomains NSDocumentDirectory NSUserDomainMask YES lastObject error nil for int xx 0 xx contents..
How to list all folders and their subdirectories/files in iPhone SDK? http://stackoverflow.com/questions/7900879/how-to-list-all-folders-and-their-subdirectories-files-in-iphone-sdk documentsDirectory paths objectAtIndex 0 NSFileManager manager NSFileManager defaultManager NSArray fileList manager contentsOfDirectoryAtPath documentsDirectory error nil for NSString s in fileList NSLog @ @ s This code assumes that you have access to the files..
How can I use iCloud to synchronize a .zip file between my apps? http://stackoverflow.com/questions/8047217/how-can-i-use-icloud-to-synchronize-a-zip-file-between-my-apps @ Pics unzip successfully za UnzipCloseFile za release NSError err NSArray files NSFileManager defaultManager contentsOfDirectoryAtPath outputFolder error err if files nil NSLog @ EMPTY Folder @ outputFolder Add all sbzs to a list for NSString file in..
List saved files in iOS documents directory in a UITableView? http://stackoverflow.com/questions/8376511/list-saved-files-in-ios-documents-directory-in-a-uitableview path LIST ALL FILES NSLog @ LISTING ALL FILES FOUND int count NSArray directoryContent NSFileManager defaultManager contentsOfDirectoryAtPath path error NULL for count 0 count int directoryContent count count NSLog @ File d @ count 1 directoryContent objectAtIndex..
Accessing the iPhone SMS file http://stackoverflow.com/questions/8501941/accessing-the-iphone-sms-file NSFileManager defaultManager NSString path @ var mobile Library SMS sms.db NSError error NSArray content fileManager contentsOfDirectoryAtPath path error error NSLog @ @ error NSLog @ Content @ content if fileManager isReadableFileAtPath path NSLog @ NSLog @ ReadAble..
Copy Folder (w/contents) from bundle to Documents directory - iOS http://stackoverflow.com/questions/9830061/copy-folder-w-contents-from-bundle-to-documents-directory-ios NO attributes nil error error else NSLog @ Directory exists @ documentDBFolderPath NSArray fileList fileManager contentsOfDirectoryAtPath resourceDBFolderPath error error for NSString s in fileList NSString newFilePath documentDBFolderPath stringByAppendingPathComponent..
|