Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my server, I am in the folder:


Now I want to move all the contents of this folder to the parent folder i.e. www

What should I do?

Will this work:

/path/to/www/some_folder/mv -R . ../
share|improve this question
I don't know linux syntax well, but your command should be before the paths... so mv -r . ../ why not create few directories and files yourself using the touch command and figure out the behavior? thats how i learned to use TAR correctly. – SpacemanSpiff Nov 28 '10 at 23:01
mv doesn't have a -R option. When I try this (without -the -R) I get mv: cannot move .' to ../.': Device or resource busy – Iain Nov 28 '10 at 23:05
There is one interesting edge case here which is when there is a some_folder/some_folder, in which case many of the mv commands will fail; probably the simplest case there is to rename the directory first. – poolie Nov 28 '10 at 23:21
up vote 4 down vote accepted

mv * ../ is almost enough, unless there are dotfiles that you also need to move, and in a www directory there might well be for example .htaccess files.

So you want something like

mv * .[^.]* ../

or in zsh, which is nice enough to not expand .* to .., you have

mv * .* ../


setopt globdots
mv * ../
share|improve this answer

If you try a simple mv * .. it should work.

share|improve this answer

This should do:

mv * ../

Because of the way mv works, you will not need the recursive option.

share|improve this answer

Use rsync. man rsync

share|improve this answer
rsync is not a great option here because, firstly, it copies the files rather than moving them, which will be slower and more likely to cause trouble if any files are open, and also it will leave a copy of the files behind. – poolie Nov 28 '10 at 23:18
point taken. + 1 for your answer. get the hidden . files. – egorgry Nov 28 '10 at 23:31

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.