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