remove all directories except one linux code example Example: delete all folders except one linux find * -maxdepth 0 -name 'b' -prune -o -exec rm -rf '{}' ';'