stat file, uses if-else instead of try-except.