Easiest way to check if an arbitrary String is a valid filename
Check against GetInvalidFileNameChars()
:
var isValid = !string.IsNullOrEmpty(fileName) &&
fileName.IndexOfAny(Path.GetInvalidFileNameChars()) < 0 &&
!File.Exists(Path.Combine(sourceFolder, fileName));
Check whether filename.IndexOfAny(Path.GetInvalidFileNameChars()) < 0
and !File.Exists(Path.Combine(someFolder, filename))