Move . to foo excluding foo
I don’t think you can do this with the mv
command alone, so I use find
.
Test first:
find . -depth 1 ! -name foo -exec echo {} \;
Do the move:
find . -depth 1 ! -name foo -exec mv {} foo \;
Stack excludes as required:
find . -depth 1 ! -name foo ! -name bar -exec mv {} foo \;