Improved method of cleaning out directories by first looking to see whether the directory exists