Checks file name firstly.