ファイルの移動
1. NSFileManager* manager = [NSFileManager defaultManager]; [manager changeCurrentDirectoryPath:uncompressPath]; NSString* temporaryDirectoryName = @"Lupin"; int i; for (i=1;;i++) { if ([manager fileExistsAtPath:temporaryDirectoryName]) temporaryDirectoryName = [NSString stringWithFormat:@"Lupin%d",i]; else break; } [manager createDirectoryAtPath:temporaryDirectoryName attributes:dic]; 3. NSString* filePath; while ((filePath = [enumerator nextObject])) { result = [manager movePath:filePath toPath:parentPath handler:self]; if (!result) NSLog(@"Failed to move from %@ to %@",filePath,parentPath); } [manager removeFileAtPath:temporaryDirectoryName handler:nil];
実際にはmovePathのhandlerに指定したオブジェクトに
-(BOOL)fileManager:(NSFileManager *)manager shouldProceedAfterError:(NSDictionary *)errorDict
が実装されていれば呼び出され、その中でYESを返せば処理に成功したことになります。
でもやっぱり使わないかも。