public static Result RemoveSectionParts(string courseRootPath) { foreach (var file in Directory.EnumerateFiles(courseRootPath, "*.mp4", SearchOption.AllDirectories)) { try { var videoFileName = VideoFileParser.ParseFromFileNameInLongFormat(file); string newFullFilePath = Path.Combine(Path.GetDirectoryName(file), videoFileName.Lecture.ToString()); File.Move(file, newFullFilePath); } catch (Exception ex) { return(Result.Fail($"Error parsing file->{file}. Exception:{ex}")); } } return(Result.Ok()); }
public static VideoFile CreateFromFileNameInLongFormat(string fullFilePath) { return(new VideoFile(fullFilePath, VideoFileParser.ParseFromFileNameInLongFormat(fullFilePath))); }