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

mv,Directory not empty不能目錄覆蓋

系統 2358 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條評論
主站蜘蛛池模板: 欧美乱大交xxxxx在线观看 | 久久精品阿娇 | 欧美日本中文字幕 | 在线免费观看视频a | 一区二区成人国产精品 | 久久麻豆精品 | 欧美一区二区手机在线观看视频 | 看黄色免费网站 | 99久久国产免费福利 | 国产一区亚洲一区 | 高清在线一区二区三区亚洲综合 | 国产一区二区免费福利片 | 国产免费一级精品视频 | 免费人成在线观看网站品爱网 | 国产成人精品三级91在线影院 | 欧美日韩国产另类一区二区三区 | 奇米影视777在线观看 | 久久婷婷综合在线视频观看6 | 在线观看精品国产 | 欧美天天爽 | 欧美韩国日本在线观看 | 久久99精品一级毛片 | 久久99精品国产麻豆宅宅 | 三上悠亚在线一区 | 欧美操操 | 亚洲精品久久激情影院 | 玖玖国产 | 国产在线观看a | 亚洲日韩欧美一区二区在线 | 精品中文字幕在线 | 久久久久亚洲国产 | 尤物视频一区 | se成人国产精品 | 六月丁香深爱六月综合激情 | 狠狠操夜夜爱 | 国产精品一区二区三区免费 | 成人性开放大片 | 国产亚洲天堂 | 热久久99精品这里有精品 | 天天爽天天爽 | 欧美视频三区 |