IOS sandbox usage and iOS sandbox usage
Path for creating a sandbox:
NSFileManager * fileManager = [NSFileManager defaultManager];
NSArray * documentPaths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES );
NSLog (@ "documentPath % @", documentPaths );
NSString * ourDocumentPath = [documentPaths objectAtIndex: 0];
NSLog (@ "ourDocumentPath = % @", ourDocumentPath );
NSString * fileName = [ourDocumentPath stringByAppendingPathComponent: @ "MOVeee"];
[FileManager createDirectoryAtPath: fileName withIntermediateDirectories: YES attributes: nil error: nil];
Add folders and files
NSString * testPath = [testDirectory stringByAppendingPathComponent: @ "test00.txt"];
NSString * testPath2 = [testDirectory stringByAppendingPathComponent: @ "test22.txt"];
NSString * testPath3 = [testDirectory stringByAppendingPathComponent: @ "test33.txt"];
NSString * string = @ "write content, write String ";
[FileManager createFileAtPath: testPath contents: [string dataUsingEncoding: NSUTF8StringEncoding] attributes: nil];
[FileManager createFileAtPath: testPath2 contents: [string dataUsingEncoding: NSUTF8StringEncoding] attributes: nil];
[FileManager createFileAtPath: testPath3 contents: [string dataUsingEncoding: NSUTF8StringEncoding] attributes: nil];
Retrieve all file names in the directory Column
NSArray * paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES );
NSString * documentsDirectory = [paths objectAtIndex: 0];
NSLog (@ "documentsDirectory % @", documentsDirectory );
NSFileManager * fileManage = [NSFileManager defaultManager];
NSString * myDirectory = [documentsDirectory stringByAppendingPathComponent: @ "test"];
NSArray * file = [fileManage subpathsOfDirectoryAtPath: myDirectory error: nil];
NSLog (@ "% @", file );
NSArray * files = [fileManage subpathsAtPath: myDirectory];
NSLog (@ "% @", files );