zhyiwww
          用平實(shí)的筆,記錄編程路上的點(diǎn)點(diǎn)滴滴………
          posts - 536,comments - 394,trackbacks - 0

          場景:
          做一個(gè)項(xiàng)目模板,如下:
          test@andy-N61Vn:/tmp/xxx$ ll proj_template/
          total 28
          drwxrwxr-x 5 test test 4096 2012-07-10 11:46 ./
          drwxrwxr-x 3 test test 4096 2012-07-10 11:46 ../
          -rw-rw-r-- 1 test test  842 2012-07-10 11:46 .classpath
          -rw-rw-r-- 1 test test 1052 2012-07-10 11:46 .project
          drwxrwxr-x 2 test test 4096 2012-07-10 11:46 .settings/
          drwxrwxr-x 3 test test 4096 2012-07-10 11:46 src/
          drwxrwxr-x 5 test test 4096 2012-07-10 11:46 WebRoot/
          新建項(xiàng)目:
          從項(xiàng)目模板復(fù)制,用以下命令:
          test@andy-N61Vn:/tmp/xxx$ cp proj_template/ demo -rf

          就可以從模板項(xiàng)目創(chuàng)建一個(gè)新的項(xiàng)目。
          項(xiàng)目文件如下:
          test@andy-N61Vn:/tmp/xxx$ ll demo/
          total 28
          drwxrwxr-x 5 test test 4096 2012-07-10 11:48 ./
          drwxrwxr-x 4 test test 4096 2012-07-10 11:48 ../
          -rw-rw-r-- 1 test test  842 2012-07-10 11:48 .classpath
          -rw-rw-r-- 1 test test 1052 2012-07-10 11:48 .project
          drwxrwxr-x 2 test test 4096 2012-07-10 11:48 .settings/
          drwxrwxr-x 3 test test 4096 2012-07-10 11:48 src/
          drwxrwxr-x 5 test test 4096 2012-07-10 11:48 WebRoot/
          假如:
          我已經(jīng)有了一個(gè)目錄,如proj2,里面沒有文件,如下:
          test@andy-N61Vn:/tmp/xxx$ ll proj2
          total 8
          drwxrwxr-x 2 test test 4096 2012-07-10 11:50 ./
          drwxrwxr-x 5 test test 4096 2012-07-10 11:50 ../
          再做文件復(fù)制:
          test@andy-N61Vn:/tmp/xxx$ cp proj_template/* proj2/ -rf
          test@andy-N61Vn:/tmp/xxx$ ll proj2/
          total 16
          drwxrwxr-x 4 test test 4096 2012-07-10 11:51 ./
          drwxrwxr-x 5 test test 4096 2012-07-10 11:50 ../
          drwxrwxr-x 3 test test 4096 2012-07-10 11:51 src/
          drwxrwxr-x 5 test test 4096 2012-07-10 11:51 WebRoot/
          我們可以發(fā)現(xiàn),在模板項(xiàng)目中存在的隱藏文件.project .classes .
          .settings/并沒有復(fù)制過來。

          解決辦法:
          使用如下命令:
          test@andy-N61Vn:/tmp/xxx$ cp proj_template/.  proj2 -rf
          test@andy-N61Vn:/tmp/xxx$ ll proj2/
          total 28
          drwxrwxr-x 5 test test 4096 2012-07-10 11:52 ./
          drwxrwxr-x 5 test test 4096 2012-07-10 11:50 ../
          -rw-rw-r-- 1 test test  842 2012-07-10 11:52 .classpath
          -rw-rw-r-- 1 test test 1052 2012-07-10 11:52 .project
          drwxrwxr-x 2 test test 4096 2012-07-10 11:52 .settings/
          drwxrwxr-x 3 test test 4096 2012-07-10 11:51 src/
          drwxrwxr-x 5 test test 4096 2012-07-10 11:51 WebRoot/

          上面的命令可以實(shí)現(xiàn)連同隱藏文件一同復(fù)制。
          注意:
          命令的關(guān)鍵地方,也就是紅色字體的地方。





          |----------------------------------------------------------------------------------------|
                                     版權(quán)聲明  版權(quán)所有 @zhyiwww
                      引用請注明來源 http://www.aygfsteel.com/zhyiwww   
          |----------------------------------------------------------------------------------------|
          posted on 2012-07-10 11:52 zhyiwww 閱讀(3523) 評(píng)論(1)  編輯  收藏

          FeedBack:
          # re: 用cp命令復(fù)制隱藏文件
          2013-06-05 12:20 | 啊啊啊
          當(dāng)用cp的時(shí)候 想要復(fù)制隱藏的文件一起走
          不要 cp -r ./templates/* ./templates.new

          直接 cp -r templates/ templates.new

          使用后面的方法就可以復(fù)制隱藏文件或者文件夾一起走了   回復(fù)  更多評(píng)論
            

          只有注冊用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 丹寨县| 县级市| 定襄县| 高阳县| 西吉县| 刚察县| 龙里县| 三门县| 巩义市| 隆德县| 遵化市| 元氏县| 辽宁省| 农安县| 黄梅县| 那坡县| 兴义市| 从江县| 余庆县| 桓台县| 榆树市| 星座| 广河县| 黄龙县| 阳谷县| 大悟县| 清河县| 康马县| 罗田县| 望奎县| 彭山县| 建德市| 清镇市| 景宁| 长汀县| 同仁县| 体育| 织金县| 凤阳县| 黑水县| 贡嘎县|