Use 'mv' command to move files except those in a specific directory
Looks like the version of bash on recent versions of macOS is a bit older than you'll find on some new Linux distros. I see version 3.2.57 on macOS High Sierra and Mojave and version 4.2.46 on RedHat Enterprise Linux 7.

Here's some syntax you can use to exclude the directories, as you've specified:

# move everything but dir1 &amp; dir2 into dir1
mv *[^dir1dir2]* dir1


And, the nice thing is, the syntax above ought to work in bash on both macOS and Linux.