I have two folders, one that I know the name of, and one that I don't:
~/foobar-as9df7 # I know the name of this one
~/foobar-7fq92h # I don't know the name of that one
How can I delete the folder that starts with foobar- and is NOT ~/foobar-as9df7, and that I don't know the name of?
Said differently, I want to rm -rf ~/foobar-as9df7 except that I don't know it's called foobar-as9df7, I only know its name starts with foobar- and it's not foobar-as9df7.
I've tried doing:
find foobar-* ! -name "foobar-as9df7" -exec rm -rf {} \;
which works but strangely this triggers a message saying:
find: ‘foobar-7fq92h’: No such file or directory
-- EDIT
the output of this command:
find ~/ -type d -name 'foobar-*' ! -name 'foobar-as9df7' -exec echo .rm -r {} +
is as follows:
.rm -r /home/ubuntu/foobar-7fq92h