Check if file exists before executing it