Ubuntu – How to move all files in current folder to subfolder


I am at the path:


And I create a sub folder:


Now I want to move all files and folders/sub-folders in the downloads folder to the sub-folder.

how can I do this?

I tried:

mv -R *.* new/

But move doesn't take the -R switch it seems.

Best Answer

The command

mv !(new) new

should do the trick. If it doesn't work, run shopt -s extglob first.

To also move hidden files/directories (that beginning with a dot), run also shopt -s dotglob first.
So, to sum up:

shopt -s extglob dotglob
mv !(new) new
shopt -u dotglob

(it is always better to unset dotglob to avoid bad surprises).