{"id":7550,"date":"2018-05-07T23:33:18","date_gmt":"2018-05-07T15:33:18","guid":{"rendered":"http:\/\/www.zhangxinxu.com\/wordpress\/?p=7550"},"modified":"2018-07-21T19:55:19","modified_gmt":"2018-07-21T11:55:19","slug":"windows-bat-delete-os-x-ds_store","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2018\/05\/windows-bat-delete-os-x-ds_store\/","title":{"rendered":"windows\u7cfb\u7edf\u4e0b\u6279\u91cf\u5220\u9664OS X\u7cfb\u7edf.DS_Store\u6587\u4ef6"},"content":{"rendered":"<p>by <a href=\"http:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=7550\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=7550<\/a><br \/>\n\u672c\u6587\u53ef\u5168\u6587\u8f6c\u8f7d\uff0c\u4f46\u9700\u8981\u4fdd\u7559\u539f\u4f5c\u8005\u548c\u51fa\u5904\uff0c\u6458\u8981\u5f15\u6d41\u5219\u968f\u610f\u3002<\/p>\n<p><strong>\u66f4\u65b0\u4e0e\u4e8eN\u5929\u540e<\/strong><br \/>\n\u7ecf\u8bc4\u8bba\u53cd\u9988\uff0c\u4e0b\u9762\u8fd9\u4e2a\u65b9\u6cd5\u8363\u5347\u4e3a\u6700\u4f73\u65b9\u6cd5\uff1a<\/p>\n<blockquote><p>\u6587\u4ef6\u5939\u7a97\u53e3\u53f3\u4e0a\u89d2\u7684\u5728\u641c\u7d22\u6846\u952e\u5165 .DS_Store<br \/>\n\u5168\u9009 \u5220\u9664<br \/>\n\u6e05\u51c0\n<\/p><\/blockquote>\n<p>\u641c\u7d22\u914d\u56fe\u793a\u610f\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/201807\/2018-07-21_195345.png\" width=\"619\" height=\"326\" alt=\"\u5220\u9664.DS_Store\" class=\"alignnone size-medium\" \/><\/p>\n<h3>\u4e00\u3001\u70e6\u4eba\u7684.DS_Store\u6587\u4ef6<\/h3>\n<p>\u8bbe\u8ba1\u5e08\u7528\u7684\u7535\u8111\u662f\u9ad8\u5927\u4e0a\u7684Mac Pro\uff0c\u5f00\u53d1\u7528\u7684\u7535\u8111\u662f\u9ad8\u5927\u7684\u4f20\u7edf\u53f0\u5f0f\u673a\uff0c\u64cd\u4f5c\u7cfb\u7edf\u662fwindows\uff0c\u4e8e\u662f\uff0c\u8bbe\u8ba1\u5e08\u7ed9\u5f00\u53d1\u4f20\u6253\u5305\u56fe\u7247\u7684\u65f6\u5019\uff0c\u4e00\u89e3\u538b\uff0c\u6211\u4e86\u4e2a\u64e6\uff0c\u6bcf\u4e2a\u6587\u4ef6\u5939\u4e2d\u95f4\u90fd\u6709\u4e00\u4e2a.DS_Store\u6587\u4ef6\uff0c\u597d\u70e6\u54e6\uff01<\/p>\n<p>\u6211\u5c31\u591a\u6b21\u9047\u5230\u8fd9\u6837\u7684\u95ee\u9898\uff0c\u5e73\u5e38\u6587\u4ef6\u5939\u5c31\u51e0\u5c42\u76ee\u5f55\uff0c\u624b\u52a8\u5220\u6389\u5c31\u597d\u4e86\uff0c\u4e16\u754c\u6e05\u9759\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u6700\u8fd1\u6709\u4e00\u6b21\uff0c\u597d\u51e0\u5341\u4e2a\u6587\u4ef6\u5939\uff0c\u6bcf\u4e2a\u6587\u4ef6\u5939\u4e2d\u90fd\u6709\u4e00\u4e2a.DS_Store\u6587\u4ef6\uff0c\u6709\u7684\u6587\u4ef6\u5939\u5d4c\u5957\u597d\u51e0\u5c42\uff0cOh my god! \u8981\u662f\u4e00\u4e2a\u4e00\u4e2a\u5220\uff0c\u771f\u4e0d\u5982\u4e00\u5200\u5250\u4e86\u6211\u3002<\/p>\n<p>\u5e78\u597d\uff0c\u81ea\u5df1\u4f1a\u4e00\u70b9\u76ae\u6bdbNode.js\uff0c\u4e8e\u662f\uff0c\u53c2\u7167\u201c<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/2016\/06\/csser-how-to-use-nodejs\/\">JS\u4e00\u822c\u822c\u7684\u7f51\u9875\u91cd\u6784\u53ef\u4ee5\u4f7f\u7528Node.js\u505a\u4e9b\u4ec0\u4e48<\/a>\u201d\u8fd9\u7bc7\u6587\u7ae0\u4e2d\u7684\u5957\u8def\uff0c\u6b58\u6b58\u6b58\u5341\u51e0\u5206\u949f\u5c31\u5199\u597d\u4e86\u4e00\u4e2a\u5c0f\u5de5\u5177\uff0cbiang\u4e00\u4e0b\u5c31\u80fd\u628a\u6587\u4ef6\u5939\u53ca\u5176\u5b50\u6587\u4ef6\u5939\u4e2d\u5168\u90e8.DS_Store\u6587\u4ef6\u5220\u9664\uff0c\u8fd9\u4e00\u77ac\u95f4\u7684\u6ee1\u8db3\u611f\u582a\u6bd4\u5fc3\u7231\u7684\u5973\u4eba\u5bf9\u7740\u81ea\u5df1\u8bf4\u6211\u7231\u4f60\uff0c\u771f\u771f\u5207\u5207\u611f\u53d7\u5230\u4f1a\u5199\u70b9\u4ee3\u7801\u8fd8\u771f\u6709\u7528\u3002<\/p>\n<p>\u4f30\u8ba1\u4ee5\u540e\u4e5f\u4f1a\u7528\u5f97\u5230\uff0c\u4e8e\u662f\u653e\u5728\u8fd9\u91cc\u5907\u5fd8\u4e0b\u3002<\/p>\n<h3>\u4e8c\u3001\u6279\u91cf\u5220\u9664.DS_Store\u6587\u4ef6\u7684Node.js\u5c0f\u5de5\u5177<\/h3>\n<p>\u65b0\u5efa\u4e2aJS\u6587\u4ef6\uff0c\u5047\u8bbe\u540d\u79f0\u662f<code>no-ds.js<\/code>\uff0c\u5199\u5165\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre>\nconst fs = require('fs');\nstat = fs.stat;\nconst path = require('path');\n<span style=\"color:green;\">\/**\n * \u5220\u9664\u76ee\u5f55\u4e0b .DS_Store \u6587\u4ef6\u65b9\u6cd5\n * @param  String dir \u6587\u4ef6\u5939\u540d\u79f0\n *\/<\/span>\nlet nods = function (dir) {\n    fs.readdir(dir, function(err, files) {\n        files.forEach(function(filename) {\n            var src = path.join(dir, filename);\n            stat(src, function (err, st) {\n                if (err) { throw err; }\n                <span style=\"color:green;\">\/\/ \u5224\u65ad\u662f\u5426\u4e3a\u6587\u4ef6<\/span>\n                if (st.isFile()) {\n                    if (\/\\.DS_Store$\/.test(filename)) {\n                        fs.unlink(src, (err) =&gt; {\n                          if (err) throw err;\n                          console.log('\u6210\u529f\u5220\u9664' + src);\n                        });\n                    }\n                } else {\n                    <span style=\"color:green;\">\/\/ \u4f5c\u4e3a\u6587\u4ef6\u5939\u5904\u7406<\/span>\n                    nods(src);\n                }\n            });\n        });\n    });\n};\n\nnods('.\/');<\/pre>\n<p>\u628a\u8fd9\u4e2aJS\u6587\u4ef6\u653e\u5728\u60f3\u8981\u5220\u9664\u7684\u6587\u4ef6\u5939\u6839\u76ee\u5f55\u4e0b\uff0c\u547d\u4ee4\u884c\u5de5\u5177\u4e2d\u6267\u884c\u4e0b\uff1a<\/p>\n<pre>node no-ds<\/pre>\n<p>\u6240\u6709<code>.DS_Store<\/code>\u5c31\u5168\u90e8\u4e0d\u89c1\u5566\uff01<\/p>\n<h3>\u4e09\u3001\u4e0d\u61c2\u4ee3\u7801\u7684\u4eba\u5982\u4f55\u4f7f\u7528\u8fd9\u4e2a\u5c0f\u5de5\u5177\u5462\uff1f<\/h3>\n<ol>\n<li><a href=\"https:\/\/nodejs.org\/en\/\" rel=\"noopener\" target=\"_blank\">Node.js\u5b98\u7f51<\/a>\u4e0b\u8f7dNode.js\u5e76\u5b89\u88c5\uff1a\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201805\/2018-05-07_225008.png\" width=\"604\" height=\"305\" alt=\"\u4e0b\u8f7d\u5b89\u88c5\u63a8\u8350\" class=\"alignnone\" \/><\/p>\n<p>\u63a8\u8350\u5b89\u88c5\u63a8\u8350\u7248\u3002<\/li>\n<li>\u4e0b\u8f7d\u540e\u9762\u8fd9\u4e2a\u6587\u4ef6\uff1a<a href=\"\/study\/down\/no_DS.zip\" rel=\"noopener\" target=\"_blank\">no_DS.zip<\/a>\n<p>\u89e3\u538b\uff0c\u4f1a\u770b\u5230\u6709\u4e2a\u540d\u4e3a<code>no-ds.js<\/code>\u548c<code>run.bat<\/code>\u7684\u4e24\u4e2a\u6587\u4ef6\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201805\/2018-05-07_225339.png\" width=\"144\" height=\"85\" alt=\"no-ds.js\u548crun.bat\u4e24\u4e2a\u6587\u4ef6\" class=\"alignnone\" \/><\/p>\n<p>\u54ea\u4e2a\u6587\u4ef6\u5939\u9700\u8981\u6e05\u9664\u6240\u6709\u7684<code>.DS_Store<\/code>\u6587\u4ef6\uff0c\u5c31\u628a\u8fd9\u4e24\u4e2a\u6587\u4ef6\u590d\u5236\u5230\u8fd9\u4e2a\u6587\u4ef6\u5939\u4e2d\uff0c\u7136\u540e\u53cc\u51fb\u4e0b<code>run.bat<\/code>\uff0c\u6574\u4e2a\u4e16\u754c\u6e05\u51c0\u4e86\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201805\/qingjing.jpg\" width=\"240\" height=\"171\" alt=\"\u6574\u4e2a\u4e16\u754c\u6e05\u51c0\u4e86\" class=\"alignnone\" \/>\n<\/li>\n<\/ol>\n<h3>\u56db\u3001\u7ed3\u675f\u8bed<\/h3>\n<p>\u672c\u5de5\u5177\u5728\u547d\u4ee4\u884c\u5de5\u5177\u7528\u5f97\u5f88\u719f\u7684\u4eba\u773c\u4e2d\u53ef\u80fd\u4f1a\u89c9\u5f97\u591a\u6b64\u4e00\u4e3e\u4e86\uff0c\u4e00\u884c\u547d\u4ee4\u4e8b\u60c5\u641e\u8fd9\u4e48\u590d\u6742\u3002\u4e0d\u597d\u610f\u601d\uff0c\u672f\u4e1a\u6709\u4e13\u653b\uff0c\u547d\u4ee4\u884c\u4e0d\u719f\uff0c\u53ea\u80fd\u7528\u81ea\u5df1\u4f1a\u7684\u4e00\u70b9\u77e5\u8bc6\u6765\u51d1\u3002<\/p>\n<p>\u5982\u679c\u4f1a\u6279\u5904\u7406\u8bed\u6cd5\uff0c\u5e94\u8be5\u4e00\u4e2a\u6279\u5904\u7406\u6587\u4ef6\u5c31\u53ef\u4ee5\u641e\u5b9a\u4e86\uff0c\u6b22\u8fce\u6bd4\u8f83\u64c5\u957f\u5c0f\u4f19\u4f34\u8d21\u732e\u4ee3\u7801\uff0c\u6211\u4f1a\u5728\u672c\u6587\u4e2d\u4e00\u540c\u5206\u4eab\u3002<\/p>\n<hr>\n<p>\u4eca\u5929\u53d1\u73b0\u81ea\u5df1\u7684\u300aCSS\u4e16\u754c\u300b\u77ed\u77ed6\u4e2a\u6708\u4e0d\u5230\u5df2\u7ecf\u51fa\u5e932\u4e07\u591a\u518c\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201805\/2018-05-07_220027.png\" width=\"400\" height=\"293\" alt=\"CSS\u4e16\u754c2\u4e07\u518c\" class=\"alignnone\" \/><\/p>\n<p>\u662f\u65f6\u5019\u641e\u4e00\u6ce2\u62bd\u5956\u56de\u8d60\u4e4b\u7c7b\u7684\u6d3b\u52a8\u3002<\/p>\n<p>\u5927\u5bb6\u89c9\u5f97\u56de\u8d60\u4ec0\u4e48\u7269\u54c1\u6bd4\u8f83\u597d\u5462\uff1f\u9884\u7b97100\u4ee5\u4e0b\u3002<\/p>\n<p>\u6211\u80fd\u60f3\u5230\u7684\u6709\uff1a<\/p>\n<ul>\n<li>\u300aCSS\u4e16\u754c\u300b\u6307\u5b9a\u5bc4\u8bed\u7b7e\u540d\u7248\uff08\u4ef7\u503c69\uff09<\/li>\n<li>\u201cCSS\u4e16\u754c\u201d\u6587\u5316\u886b\uff08\u4ef7\u503c69\uff09<\/li>\n<li>\u54c8\u58eb\u5947\u4f01\u9e45\u516c\u4ed4\uff08\u4ef7\u503c60\uff09\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201805\/2018-05-07_231952.png\" width=\"206\" height=\"240\" alt=\"\u54c8\u58eb\u5947\u4f01\u9e45\u516c\u4ed4\" class=\"alignnone\" \/><\/li>\n<li>\u8d77\u70b9\u70b9\u5a18\u7b14\u8bb0\u672c\uff08\u4ef7\u503c49\uff09\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201805\/dn-book.jpg\" width=\"176\" height=\"240\" alt=\"\u8d77\u70b9\u70b9\u5a18\u7b14\u8bb0\u672c\" class=\"alignnone\" \/><\/li>\n<li>Q\u5e01\u82e5\u5e72\uff08\u4ef7\u503c50\uff09<\/li>\n<\/ul>\n<p>\u4e0d\u77e5\u5927\u5bb6\u6709\u6ca1\u6709\u66f4\u597d\u7684\u60f3\u6cd5\uff1f<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201611\/14.png\" align=\"absmiddle\"><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u4f1a\u7ecf\u5e38\u66f4\u65b0\u77e5\u8bc6\u70b9\u4ee5\u53ca\u4fee\u6b63\u4e00\u4e9b\u9519\u8bef\uff0c\u56e0\u6b64\u8f6c\u8f7d\u8bf7\u4fdd\u7559\u539f\u51fa\u5904\uff0c\u65b9\u4fbf\u6eaf\u6e90\uff0c\u907f\u514d\u9648\u65e7\u9519\u8bef\u77e5\u8bc6\u7684\u8bef\u5bfc\uff0c\u540c\u65f6\u6709\u66f4\u597d\u7684\u9605\u8bfb\u4f53\u9a8c\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=7550\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=7550<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bbe\u8ba1\u5e08\u7528\u7684\u7535\u8111\u662f\u9ad8\u5927\u4e0a\u7684Mac Pro\uff0c\u5f00\u53d1\u7528\u7684\u7535\u8111\u662f\u9ad8\u5927\u7684\u4f20\u7edf\u53f0\u5f0f\u673a\uff0c\u64cd\u4f5c\u7cfb\u7edf\u662fwindows\uff0c\u4e8e\u662f\uff0c\u8bbe\u8ba1\u5e08\u7ed9\u5f00\u53d1\u4f20\u6253\u5305\u56fe\u7247\u7684\u65f6\u5019\uff0c\u4e00\u89e3\u538b\uff0c\u6211\u4e86\u4e2a\u64e6\uff0c\u6bcf\u4e2a\u6587\u4ef6\u5939\u4e2d\u95f4\u90fd\u6709\u4e00\u4e2a.DS_Store\u6587\u4ef6\uff0c\u597d\u70e6\u54e6\uff0c\u5982\u4f55\u6279\u91cf\u6e05\u9664\u8fd9\u4e9b\u70e6\u4eba\u7684\u6587\u4ef6\u5462\uff0c\u5176\u5b9e\u5f88\u7b80\u5355\uff0c\u53ea\u4f1a\u4e00\u4e22\u4e22JS\u7684\u6211\u4e5f\u80fd\u5199\u4e00\u4e2a\u5c0f\u5de5\u5177\u641e\u5b9a\uff0c\u6211\u662f\u5982\u4f55\u641e\u5b9a\u7684\u5462\uff1f\u4e00\u8d77\u8fdb\u6765\u770b\u770b\u5427~<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[180],"tags":[1051,728,525,466,510,1246],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/7550"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=7550"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/7550\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=7550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=7550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=7550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}