private void SelectedDriveChanged() { var videos = IOExtensions.VideoExtensions.SelectMany(f => IOExtensions.GetFilesRecursiv(SelectedDrive, f)).Where(p => !p.StartsWith(".")).Distinct().Select(p => new Video(p)); var tmpDirectoryPath = Path.Combine(_rootDirectory, "temp"); if (Directory.Exists(tmpDirectoryPath)) { Directory.Delete(tmpDirectoryPath, true); } Directory.CreateDirectory(tmpDirectoryPath); foreach (var video in videos) { _videoService.Copy(video, Path.Combine(tmpDirectoryPath)).ContinueWith(async t => { var startTime = await _videoService.GetStartFrame(video); if (startTime.HasValue) { await _videoService.Cut(video, startTime.Value - 3, _rootDirectory); } }); } }