Checks if there are any files before erasing the directory.