Last active
August 29, 2015 14:27
-
-
Save wiig-with-a-k/bc51392b16934ff58fdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void CheckFilesInFolder(Sftp connection, string directory, List<string> errors) | |
{ | |
if (!connection.DirectoryExists(directory)) | |
return; | |
var items = connection.GetList(directory); | |
var files = items.Where(x => x.IsFile).ToList(); | |
if (files.Any(f => f.Name.EndsWith(".mp4") || f.Name.EndsWith(".mp3"))) | |
{ | |
var guid = GetFileNameWithoutQuality(files.First().Name); | |
if (!files.All(f => f.Name.StartsWith(guid+"_"))) | |
{ | |
Console.WriteLine("Failing for program with directory " + directory + " and guid " + guid); | |
errors.Add(directory); | |
} | |
} | |
var directories = items.Where(x => x.IsDirectory).ToList(); | |
directories.ForEach(x => CheckFilesInFolder(connection, directory + "/" + x.Name, errors)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment