Reworked to now check if the dir exists and if it's empty.