split directory remove into remove (file) and rmdir (directory)