"the System doesn't recognizes a Path that ends with a backslash"
Yes, it does: It says "this is a folder".
static void Main(string[] args)
{
string[] files = Directory.GetFiles(args[0]);
foreach (string s in files) Console.WriteLine(s);
args[0] = args[0].TrimEnd(Path.DirectorySeparatorChar);
foreach (string s in args)
Console.WriteLine(s);
}
Then run the app with "ConsoleTester D:\temp\", and it prints the list of files in my temporary folder.
But...Do note that Path.DirectorySeparatorChar is only backslash - it will not match a slash '/' as well, but Windows is happy with either.
And if your path ends with a separator character, it's a folder path, not a file path. So File.RealAllLines (and so forth) will not work - they need a file, not a folder.