Skip to content

Instantly share code, notes, and snippets.

@wiig-with-a-k
Created August 14, 2015 14:04
Show Gist options
  • Save wiig-with-a-k/005e850454812ddfbaf4 to your computer and use it in GitHub Desktop.
Save wiig-with-a-k/005e850454812ddfbaf4 to your computer and use it in GitHub Desktop.
private List<string> CheckFilesInFolder(Sftp connection, List<string> paths)
{
var errors = new List<string>();
foreach (var path in paths)
{
if (connection.DirectoryExists(path))
{
var files = connection.GetList(path);
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 " + path + " and guid " + guid);
errors.Add(path);
}
}
}
}
return errors;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment