怎样在linux中覆盖文件夹以及文件夹里的文件?我用mv提示》》mv: cannot move ` ' to ` ': Directory not empty

2013-05-30 18:24:39 +08:00
 elvba
DX30_R20130524_SC_UTF8.zip是Discuz_X3.0_SC_UTF8的补丁文件,我想按照官方的说法直接把补丁文件覆盖掉,但总是不成功。

[root@www27148ue bbs]# ls
DX30_R20130524_SC_UTF8.zip Discuz_X3.0_SC_UTF8.zip

[root@www27148ue bbs]# unzip -q Discuz_X3.0_SC_UTF8.zip

[root@www27148ue bbs]# unzip -q DX30_R20130524_SC_UTF8.zip

[root@www27148ue bbs]# ls
DX30_R20130524_SC_UTF8 Discuz_X3.0_SC_UTF8.zip upload
DX30_R20130524_SC_UTF8.zip readme utility

[root@www27148ue bbs]# mv -f DX30_R20130524_SC_UTF8/* upload/
mv: cannot move `DX30_R20130524_SC_UTF8/api' to `upload/api': Directory not empty
mv: cannot move `DX30_R20130524_SC_UTF8/source' to `upload/source': Directory not empty
mv: cannot move `DX30_R20130524_SC_UTF8/static' to `upload/static': Directory not empty
mv: cannot move `DX30_R20130524_SC_UTF8/template' to `upload/template': Directory not empty
24239 次点击
所在节点    问与答
7 条回复
xdeng
2013-05-30 18:26:26 +08:00
-R 目录递归啊
elvba
2013-05-30 18:28:21 +08:00
@xdeng mv没有-R和-r参数吧?

[root@www27148ue bbs]# mv --help
Usage: mv [OPTION]... [-T] SOURCE DEST
or: mv [OPTION]... SOURCE... DIRECTORY
or: mv [OPTION]... -t DIRECTORY SOURCE...
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.
--backup[=CONTROL] make a backup of each existing destination file
-b like --backup but does not accept an argument
-f, --force do not prompt before overwriting
-i, --interactive prompt before overwrite
-n, --no-clobber do not overwrite an existing file
If you specify more than one of -i, -f, -n, only the final one takes effect.
--strip-trailing-slashes remove any trailing slashes from each SOURCE
argument
-S, --suffix=SUFFIX override the usual backup suffix
-t, --target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY
-T, --no-target-directory treat DEST as a normal file
-u, --update move only when the SOURCE file is newer
than the destination file or when the
destination file is missing
-v, --verbose explain what is being done
--help display this help and exit
--version output version information and exit
xdeng
2013-05-30 18:48:47 +08:00
@elvba 忘了 你直接进DX30_R20130524_SC_UTF8/ 然后 mv * ../upload 我以前是吧 DZ解压后进去
1 upload mv * ../
2 cd ..
3 rm upload -rf
这样
xdeng
2013-05-30 18:49:43 +08:00
0 cd upload
1 mv * ../
2 cd ..
3 rm upload -rf
elvba
2013-05-30 19:06:41 +08:00
@xdeng 你没看明白我的问题,并不是把upload文件里的内容移动到上层文件夹,我想把补丁里的文件覆盖到DZ的upload文件夹里。

进入DX30_R20130524_SC_UTF8/ 然后 mv * ../upload

mv DX30_R20130524_SC_UTF8/* upload/
是一个意思。
swulling
2013-05-30 19:09:39 +08:00
用cp -r替代mv
lequiet
2013-05-31 01:16:45 +08:00
额。。。我也纠结这问题很久了,我用的是Mac,一直开windows xp虚拟机拷贝去覆盖,
因为网游要补丁升级,也需要这种方式的补丁覆盖。据同事说cp -r有时不靠谱所以没试用= =。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/70685

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX