Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
You do not need -R. Just mv * new Though, it will whine "cannot move new to new" or something similar. Perhaps mv -i * new to you prevent overwrites. –  user8290 Jan 1 '12 at 0:59

1 Answer 1

up vote 6 down vote accepted

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).

share|improve this answer
Thanks fro your info. It works for me.for an long time i looking for it. –  Mughil Jan 1 '12 at 12:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.