conditional execution of directory removal