Added dir existence check before calling rimraf.