public string[] GetAllFilesInDirectory(string path, string pattern = "*.*", SearchOption options = SearchOption.TopDirectoryOnly)
{
if (path.Trim().Length == 0)
return null; //Error handler can go here
if ((pattern.Trim().Length == 0) || (pattern.Substring(pattern.Length - 1) == "."))
return null; //Error handler can go here
if (Directory.GetFiles(path, pattern).Length == 0)
return null; //Error handler can go here
return Directory.GetFiles (path, pattern, options);
}
{
if (path.Trim().Length == 0)
return null; //Error handler can go here
if ((pattern.Trim().Length == 0) || (pattern.Substring(pattern.Length - 1) == "."))
return null; //Error handler can go here
if (Directory.GetFiles(path, pattern).Length == 0)
return null; //Error handler can go here
return Directory.GetFiles (path, pattern, options);
}
Add a comment