Instead of using
find (which does the job well), you could also use the shell to this end.
Say you want to all files from $PWD to $DEST. The natural attempt would be:
mv $PWD/* $DEST
How does this work? The expression "$PWD/*" expands to the names of all files in that directory. This shell feature is called "globbing". The last argument of
mv is the destination directory. If you have very many files, this won't work because the length of the command line is limited.
But the solution has the problem that it omits dot files - or "hidden" files, files and directories whose name start with a ".". To solve this, you have to tell your shell to include dotfiles when globbing. To do this, use
shopt -s dotglob
bash (and you probably use
bash unless you've changed the default). In this shell, the above command will work for dotfiles as well.
As an aside, in
zsh, you have the option to choose this on a case-by-case basis. To do this, put
.zshrc. Then you can use
mv $PWD/*(D) $DEST
to move all the files, including dotfiles. (The "D" has the effect of temporarily enabling the "GLOB_DOTS" option).
Now the original question was to move all regular files (not directories) from all subdirectories and their subdirectories to a single directory. This can be accomplished with
Here the expression
**/* makes the globber descend recursively into subdirectories. The
D means "also select dotfiles'; the
. means "only select regular files, not directories".