If the files in your script must have extensions, you can use this method.
NOTE. . On Windows, it is allowed to have periods in directories, but this was mainly introduced for file compatibility with the cross operating system. In strict Windows environments, it is considered bad form to have files without extensions or to place periods or spaces in directory names. If you do not need to consider this scenario, you can use this method. If not, you will have to have some kind of flag sent through a chain or structure to identify the intent of the string.
var ext = System.IO.Path.GetExtension(strPath); if(ext == String.Empty) {
If you do not need to parse the file type, you can do this simply:
if(System.IO.Path.HasExtension(strPath)) {
source share