create function for checking files