mv: "Directory not Empty" - how do you merge directories with `mv`?

SilentKnight

I tried to deploy my personal blog website to my remote server recently. When I tried to move a few files and directories to another place by executing mv, some unexpected errors happened. The command line echoed "Directory not Empty". After doing some googling, I tried again with '-f' switch or '-v', the same result showed. I logged in on the root account, and the process is here:

root@danielpan:~# shopt -s dotglob
root@danielpan:~# mv /var/www/html/wordpress/* /var/www/html
mv: cannot move `/var/www/html/wordpress/wp-content` to `/var/www/html/wp-content`: 
Directory not empty
root@danielpan:~# mv -f /var/www/html/wordpress/* /var/www/html
mv: cannot move `/var/www/html/wordpress/wp-content` to `/var/www/html/wp-content`:
Directory not empty

Anybody know why?

(I'm running Ubuntu 14.04)

SilentKnight

I found the solution finally. Because the /var/www/html/wp-content already exists, then when you try to copy /var/www/html/wordpress/wp-content there, error of Directory not Empty happens. So you need to copy /var/www/html/wordpress/wp-content/* to /var/www/html/wp-content. Just execute this:

mv /var/www/html/wordpress/wp-content/* /var/www/html/wp-content
rmdir /var/www/html/wordpress/wp-content
rmdir /var/www/html/wordpress

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

mv: Directory not empty

From Dev

mv: Directory not empty

From Dev

BASH - merge directories when using mv

From Dev

mv: cannot remove directory: Directory not empty

From Dev

How to force overwrite non-empty directories using `mv`

From Dev

How to do "hg mv --after" in git?

From Dev

When moving all files but-one using mv, how do you escape filenames with dashes?

From Dev

How would you bash script to combine cp and cd or mv and cd

From Dev

Why is mv so much faster than cp? How do I recover from an incorrect mv command?

From Dev

How to mv .bin bin

From Dev

mv command - how it works?

From Dev

Will `mv` ever have the ability to create directories?

From Dev

How do I pipe the output of tar through mv?

From Dev

How do I get back files after "mv * .*"?

From Dev

Using "mv" or "ditto" to merge folders in OS X

From Dev

How to handle spaces in MV command

From Dev

How to remove file with mv command?

From Dev

How to mv files one by one?

From Dev

How to restore a lost git mv?

From Dev

Move only files recursively from multiple directories into one directory with mv

From Dev

What does `mv ./*` without specifying destination do?

From Dev

What does mv do in case of errors?

From Dev

What does mv do when changing names?

From Dev

mv to file with

From Dev

How does Linux's mv work internally?

From Dev

How to use shell script variable in mv command

From Dev

How to pipe the results of 'find' to mv in Linux

From Dev

How to use the mv command in Python with subprocess

From Dev

How does hdfs mv command work