亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

mv,Directory not empty不能目錄覆蓋

系統 2580 0
    一。
    
mv /test1/* /test2/test1
rm -rf /test1

二。

You can however use rsync with the --remove-source-files option (and possibly others) to merge one directory into another.

rsync won't delete any directories, so you will have to do something like find -type d -empty -delete afterwards to get rid of the empty source directory tree.

  

?

    
      rsync -av /source/ /destination/

(after checking)

rm -rf /source/
      


--remove-source-files has the advantage of only removing files that were transferred successfully,
so you can use find to remove empty directories and will be left with everything that wasn't transferred without having to check rsync s output

    
      cd source; find -type f | xargs -n 1 -I {} mv {} dest/{}


    
  
    
      
        

三。

I'd recommend these four steps:

      
        cd ${SOURCE}; 

find . -type d -exec mkdir -p ${DEST}/\{} \; 

find . -type f -exec mv \{} ${DEST}/\{} \; 

find . -type d -empty -delete


      
    

or better yet, here's a script that implements semantics similar to mv :

      
        #!/bin/bash



DEST=${@:${#@}}; for SRC in ${@:1:$(({#@} -1))}; do   (

    cd $SRC;

    find . -type d -exec mkdir -p ${DEST}/\{} \; 

    find . -type f -exec mv \{} ${DEST}/\{} \; 

    find . -type d -empty -delete

) done


      
    
    
      
        

Here is a script that worked for me. I prefer mv over rsync, so I use Jewel and Jonathan Mayer's solutions.

              
                #!/bin/bash



# usage source1 .. sourceN dest



length=$(($#-1))

sources=${@:1:$length}

DEST=$(readlink -f ${!#})

for SRC in $sources; do

    pushd $SRC;

    find . -type d -exec mkdir -p ${DEST}/{} \;

    find . -type f -exec mv {} ${DEST}/{} \;

    find . -type d -empty -delete

    popd
              
            
    
      
        


if you use use mv --backup=numbered
(or one of the other options for the --backup switch),
then mv will complete the merge and preserve the files intended to be overwritten

mv,Directory not empty不能目錄覆蓋


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 精品亚洲性xxx久久久 | 国产免费久久精品44 | 成人免费毛片网站 | 国产视频福利一区 | 99精品免费 | 黄色在线观看视频免费 | 亚洲美女视频在线观看 | 国产精品88| 神马影院我不卡影院 | 一级爱爱片一级毛片-一毛 一级白嫩美女毛片免费 | 青青久久国产成人免费网站 | 日韩视频一区二区 | 亚欧在线免费观看 | 四虎在线永久 | 中国大陆高清aⅴ毛片 | 日本高清毛片视频在线看 | 九九热在线视频免费观看 | 水浒传删减剧情在线观看 | 日韩高清一区 | 亚色在线视频 | 国产欧美一区二区三区免费看 | 在线综合+亚洲+欧美中文字幕 | 日韩午夜伦 | jizzjiz熟丰满老妇日本 | 亚州色拍拍拍 | 热99在线观看 | 久久精品国产69国产精品亚洲 | 奇米影音四色 | 国产精彩视频 | 久操社区| 香港三级做爰大爽视频 | 亚洲国产成人精彩精品 | 91在线看片 | 4hu四虎最新免费地址 | 免费一级成人免费观看 | 亚洲第一永久在线观看 | 亚洲黄色小视频 | 天天综合色天天综合网 | 综合在线播放 | 深夜在线免费 | 99热在线播放 |