오늘 날짜로 파일이름 저장하기
// filename now
NSDate *now = [NSDate date];
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"YYYYMMdd_HHmmss"];
filenameNow = [format stringFromDate:now];
// file save Start
NSString *DocPath;
NSString *filePath;
DocPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
filePath = [DocPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.mov", filenameNow]];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]) {
NSLog(@"file exist:%s url:%@",[DocPath UTF8String],fileURL);
[fileManager removeItemAtURL:fileURL error:nil];
}
댓글
댓글 쓰기