Use pahtinfo instead of string functions to get the file extension