Add error handling on empty folder

Exit if the folder is empty