V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
elvba
V2EX  ›  问与答

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

  •  
  •   elvba · 2013-05-30 18:24:39 +08:00 · 24219 次点击
    这是一个创建于 4201 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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
    7 条回复    1970-01-01 08:00:00 +08:00
    xdeng
        1
    xdeng  
       2013-05-30 18:26:26 +08:00   ❤️ 1
    -R 目录递归啊
    elvba
        2
    elvba  
    OP
       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
        3
    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
        4
    xdeng  
       2013-05-30 18:49:43 +08:00
    0 cd upload
    1 mv * ../
    2 cd ..
    3 rm upload -rf
    elvba
        5
    elvba  
    OP
       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
        6
    swulling  
       2013-05-30 19:09:39 +08:00
    用cp -r替代mv
    lequiet
        7
    lequiet  
       2013-05-31 01:16:45 +08:00
    额。。。我也纠结这问题很久了,我用的是Mac,一直开windows xp虚拟机拷贝去覆盖,
    因为网游要补丁升级,也需要这种方式的补丁覆盖。据同事说cp -r有时不靠谱所以没试用= =。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2333 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 00:57 · PVG 08:57 · LAX 16:57 · JFK 19:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.