{"id":90870,"date":"2020-05-12T19:32:48","date_gmt":"2020-05-12T11:32:48","guid":{"rendered":"http:\/\/4563.org\/?p=90870"},"modified":"2020-05-12T19:32:48","modified_gmt":"2020-05-12T11:32:48","slug":"%e6%b1%82%e6%95%99%e4%b8%8b-linux-mv-a-b-%ef%bc%8c%e6%96%87%e4%bb%b6%e6%81%a2%e5%a4%8d-%e5%92%8c-mv-%e6%89%a7%e8%a1%8c%e8%bf%87%e7%a8%8b","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=90870","title":{"rendered":"\u6c42\u6559\u4e0b Linux mv a\/* b\/* \uff0c\u6587\u4ef6\u6062\u590d \u548c mv \u6267\u884c\u8fc7\u7a0b"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6c42\u6559\u4e0b Linux mv a\/* b\/* \uff0c\u6587\u4ef6\u6062\u590d \u548c mv \u6267\u884c\u8fc7\u7a0b               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : server <\/span>  <span><i><\/i> 13<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>RT.<\/p>\n<pre><code>mv a\/* b\/* <\/code><\/pre>\n<p>\u4eca\u5929\u8bd5\u4e86\u4e00\u4e2a mv \u64cd\u4f5c\uff0c\u5c06 a \u7684\u5185\u5bb9\u8fc1\u79fb\u5230\u7a7a\u76ee\u5f55 b \u4e0b\uff0c\u6267\u884c\u4e86\u4e0a\u9762\u7684\u547d\u4ee4\u3002\u7ed3\u679c a \u7a7a\u4e86, b \u76ee\u5f55\u4e0b\u6709\u4e2a\u4e86*<\/p>\n<pre><code>total 8 ~\/space\/workspace\/t\/b ls -an    -rw-r--r-- 1 1000 1000    0  4 \u6708 27 15:44 '*' drwxr-xr-x 2 1000 1000 4096  4 \u6708 27 15:44  . drwxr-xr-x 4 1000 1000 4096  4 \u6708 27 15:44  ..  <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1315145\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : taolu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c a \u4e0b\u6709\u591a\u4e2a\u6587\u4ef6\uff0c\u8fd9\u6837\u64cd\u4f5c\u662f\u4e0d\u5141\u8bb8\u7684\uff0c\u56e0\u6b64 a \u4e0b\u539f\u672c\u5c31\u4e00\u4e2a\u6587\u4ef6\u3002\u628a b\/* \u8fd9\u4e2a\u6587\u4ef6\u91cd\u547d\u540d\u5373\u53ef\uff0c`mv * new_name`                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1315146\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u91cc\u4e3b\u8981\u7684\u95ee\u9898\u662f\uff0c\u4f60\u8bef\u4ee5\u4e3a<br \/>b\/*<br \/>\u662f\u76ee\u6807<\/p>\n<p>\u4f46\u5176\u5b9e b\/*\u5c55\u5f00\u4e4b\u540e\uff0c\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u624d\u662f\u76ee\u6807                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1315147\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ddzzhen <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             mv a\/* b\/                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1315148\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : superrichman <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u80fd\u6587\u4ef6\u5df2\u7ecf\u56de\u4e0d\u6765\u4e86\uff1f \u8ddf\u79fb\u52a8\u5230 \/dev\/null \u5dee\u4e0d\u591a\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1315149\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iFollow <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @taolu <br \/>\u53ef\u662f b \u76ee\u5f55\u4e0b\u65b0\u51fa\u6765\u7684 * \u6587\u4ef6\u5927\u5c0f\u662f 0 \uff1f<\/p>\n<p>@julyclyde <br \/>\u9898\u4e3b\u8bf4 b \u662f\u7a7a\u76ee\u5f55\u3002<\/p>\n<p>\u6211\u5728 Ubuntu 16.04 \u4e0a\u7684\u6d4b\u8bd5\u7ed3\u679c\uff1a<br \/>:$ ls a<br \/>a1 a2 a3<br \/>:$ <br \/>:$ ls b<br \/>:$ <br \/>:$ mv a\/* b\/*<br \/>mv: target &#8216;b\/*&#8217; is not a directory<br \/>:$ <br \/>:$ ls a<br \/>a1 a2 a3<br \/>:$ ls b<br \/>:$ <\/p>\n<p>\u76f4\u63a5\u62a5\u9519\u4e86\uff0c\u6ca1\u6709\u6267\u884c\u64cd\u4f5c\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1315150\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : server <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @iFollow zsh \u4e0b\u4f1a\u62a5\u9519, \u505a\u4e86 alias<br \/>https:\/\/github.com\/ohmyzsh\/ohmyzsh\/blob\/9817e1e7ff62494abf9d7c78870e92908567e8f4\/plugins\/common-aliases\/README.md#file-handling<\/p>\n<p>&#8220;`zsh<br \/>mv mv -i Move a file<br \/>&#8220;`<\/p>\n<p>&#8220;`bash<br \/> -i, &#8211;interactive<br \/> prompt before overwrite<\/p>\n<p>&#8220;`                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1315151\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : taolu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @server <br \/>&#8220;`bash<br \/>[email&#160;protected]:~# docker run -it &#8211;rm debian bash <br \/>[email&#160;protected]:\/# cd<br \/>[email&#160;protected]:~# mkdir a b <br \/>[email&#160;protected]:~# touch a\/{1..10}.txt <br \/>[email&#160;protected]:~# ls -R a <br \/>a:<br \/>1.txt 10.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt<br \/>[email&#160;protected]:~# \/bin\/mv a\/* b\/* <br \/>\/bin\/mv: target &#8216;b\/*&#8217; is not a directory<br \/>[email&#160;protected]:~# \/bin\/mv -f a\/* b\/* <br \/>\/bin\/mv: target &#8216;b\/*&#8217; is not a directory<br \/>[email&#160;protected]:~# rm a\/{2..10}.txt<br \/>[email&#160;protected]:~# ls -R a <br \/>a:<br \/>1.txt<br \/>[email&#160;protected]:~# \/bin\/mv a\/* b\/* <br \/>[email&#160;protected]:~# ls b\/<br \/>&#8216;*&#8217;<br \/>&#8220;`                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1315152\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : server <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @taolu \u786e\u5b9e\uff0c\u8bd5\u4e86\u51e0\u4e2a\u53d1\u884c\u7248\uff0cb\/* \u662f a\/1.txt<\/p>\n<p>\u8bf4\u4e0b\u4e8b\u60c5\u7ecf\u8fc7<br \/>\u6628\u5929 \u6709\u4e2a\u5c0f\u4f19\u4f34 x51 \u4e91\u4e00\u4e2a\u76d8\u6ee1\u4e86\uff0c\u5f00\u4e86\u4e00\u4e2a\u65b0\u76d8\uff0c\u5c31\u641e\u4e86\u4e2a mv a\/* b\/*\uff0c\u540e\u9762\u5c31\u662f\u4e00\u987f\u731b\u864e\u64cd\u4f5c(\u91cd\u542f\u5927\u6cd5)\uff0c\u91cd\u542f\u540e \u539f\u76ee\u5f55\u6b63\u5e38\u3002<br \/>\u603b\u7ed3\u4e0b:<br \/>1. \u8de8\u76d8 mv \u6ca1\u6709\u521b\u5efa\u591a\u6587\u4ef6(\u5939)\uff0c\u591a\u7248\u672c\u6d4b\u8bd5\uff0c\u7ed9 v2 \u53cb\u9020\u6210\u56f0\u6270<br \/>2. \u5f88\u6709\u53ef\u80fd\u5c0f\u4f19\u4f34 \u4e4c\u9f99\u4e86<br \/>3. \u611f\u8c22 @taolu                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1315153\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : c7in7 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u8bd5\u4e00\u4e0b\u53bb                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1315154\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : c7in7 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             [[email&#160;protected] ~]# mkdir a<br \/>[[email&#160;protected] ~]# mkdir b<br \/>[[email&#160;protected] ~]# cd a<br \/>[[email&#160;protected] a]# touch 1.txt 2.txt<br \/>[[email&#160;protected] a]# ls<br \/>1.txt 2.txt<br \/>[[email&#160;protected] a]# cd ..<br \/>[[email&#160;protected] ~]# mv a\/* b\/*<br \/>mv: \u76ee\u6807&#8221;b\/*&#8221; \u4e0d\u662f\u76ee\u5f55                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6c42\u6559\u4e0b Linux mv a\/* &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/90870"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=90870"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/90870\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=90870"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=90870"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=90870"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}