Catch exception when the directory is empty