- (void)createFile
{
#define kDocumentsPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]
NSString *filePath = [kDocumentsPath stringByAppendingPathComponent:@"Download"];
NSLog(@"%@",filePath);
NSFileManager *fileManger = [NSFileManager defaultManager];
BOOL isCreateFile = [fileManger createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
NSLog(@"%d",isCreateFile);
}
- (void)moveFile
{
NSString *old = [kDocumentsPath stringByAppendingPathComponent:@"Download"];
NSString *new = [kCachesPath stringByAppendingPathComponent:@"Download"];
NSFileManager *fileManger = [NSFileManager defaultManager];
BOOL isMoved = [fileManger moveItemAtPath:old toPath:new error:nil];
NSLog(@"%d",isMoved);
}
- (void)copyFile
{
NSString *old = [kDocumentsPath stringByAppendingPathComponent:@"Download"];
NSString *new = [kCachesPath stringByAppendingPathComponent:@"Download"];
NSFileManager *fileManger = [NSFileManager defaultManager];
BOOL isCopy = [fileManger copyItemAtPath:new toPath:old error:nil];
NSLog(@"%d",isCopy);
}
- (void)deleteFile
{
NSString *new = [kCachesPath stringByAppendingPathComponent:@"Download"];
NSFileManager *fileManger = [NSFileManager defaultManager];
BOOL isDelete = [fileManger removeItemAtPath:new error:nil];
NSLog(@"%d",isDelete);
}
- (void)isExistFile
{
NSString *old = [kDocumentsPath stringByAppendingPathComponent:@"Download"];
NSFileManager *fileManger = [NSFileManager defaultManager];
BOOL isExist = [fileManger fileExistsAtPath:old];
NSLog(@"%d",isExist);
}