avoid deleting parent path when same as base directory