Use rmtree() instead of system rm -fr