I have a directory that I is filled by another user, and I'm tasked with maintaining it. I want to delete all its content except a 2 files with a specific name. Is it possible with rm
or should I do this:
cp aaa/a ./a && cp aaa/b ./b && rm -rf aaa/* && mv ./a aaa/a && mv ./b aaa/b
where aaa
is the directory, a,b
are the files I want to keep, and there are (at least, there may be) other files/directories in there.
Is there a better (and shorter) way?
With bash extended globs, given
then
leaves