When using sudo rm -r, how can I delete all files, with the exception of the following:
sudo rm -r
textfile.txt backup.tar.gz script.php database.sql info.
If you're using zsh which I highly recommend.
rm -rf ^file/folder pattern to avoid
With extended_glob
extended_glob
setopt extended_glob rm -- ^*.txt rm -- ^*.(sql|txt)