{"id":1778,"date":"2023-05-24T23:45:34","date_gmt":"2023-05-24T15:45:34","guid":{"rendered":"https:\/\/blog.sukasuka.cn\/?p=1778"},"modified":"2023-06-13T18:11:33","modified_gmt":"2023-06-13T10:11:33","slug":"%e8%a7%a3%e5%86%b3%e6%bb%a5%e7%94%a8symlink%e5%af%bc%e8%87%b4matlab%e5%90%af%e5%8a%a8%e5%a4%b1%e8%b4%a5%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/blog.sukasuka.cn\/?p=1778","title":{"rendered":"\u89e3\u51b3\u6ee5\u7528symlink\u5bfc\u81f4matlab\u542f\u52a8\u5931\u8d25\u95ee\u9898"},"content":{"rendered":"<p>\u524d\u51e0\u5929\u7528depuGuru\u67e5\u4e86\u4e00\u4e0b\u7535\u8111\u91cc\u7684\u91cd\u590d\u6587\u4ef6\uff0c\u7136\u540e\u4e0d\u5047\u601d\u7d22\u5730\u8ba4\u4e3a\u6240\u6709\u7a0b\u5e8f\u90fd\u4f1ahandle symlink\uff0c\u7136\u540e\u4eca\u5929matlab\u5c31\u6253\u4e0d\u5f00\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.sukasuka.cn\/wp-content\/uploads\/2023\/05\/QQ\u56fe\u724720230524233954.png\" alt=\"\" width=\"496\" height=\"243\" class=\"aligncenter size-full wp-image-1779\" srcset=\"https:\/\/blog.sukasuka.cn\/wp-content\/uploads\/2023\/05\/QQ\u56fe\u724720230524233954.png 496w, https:\/\/blog.sukasuka.cn\/wp-content\/uploads\/2023\/05\/QQ\u56fe\u724720230524233954-300x147.png 300w\" sizes=\"auto, (max-width: 496px) 100vw, 496px\" \/><\/p>\n<p>\u6309\u7167\u8def\u5f84\u53bb\u627e\uff0c\u660e\u660e\u6587\u4ef6\u5b58\u5728\uff0c\u4f46\u5c31\u662f\u8bfb\u53d6\u4e0d\u4e86\u3002\u539f\u56e0\u672a\u77e5\u3002<\/p>\n<p>\u5c06symlink\u5168\u90e8\u5c55\u5f00\u56de\u6e90\u6587\u4ef6\u540e\uff0c\u95ee\u9898\u89e3\u51b3\u3002<\/p>\n<p>\u9644python\u4ee3\u7801\uff1a<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import os, shutil\r\ndef main():\r\n    base = 'D:\/Program Files\/MATLAB'\r\n    for root, ds, fs in os.walk(base):\r\n        for f in fs:\r\n            fullname = os.path.join(root, f)\r\n            try:\r\n                pa = os.readlink(fullname)\r\n                # \u82e5\u975esymlink\u8be5\u51fd\u6570\u4f1a\u62a5\u9519\uff0c\u76f4\u63a5pass\r\n            except:\r\n                pass\r\n            else:\r\n                try:\r\n                    os.unlink(fullname)\r\n                    shutil.copy(pa, fullname)\r\n                except:\r\n                    print('error: %s' % fullname)\r\n                    input()\r\n                else:\r\n                    print('ok: %s' % fullname)\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n<\/code><\/pre>\n<\/div>\n<p>2023.6.13 \u66f4\u65b0<\/p>\n<p>\u8be5\u7a0b\u5e8f\u65e0\u6cd5\u8bc6\u522b\u5df2\u6709\u7684symlink\uff0c\u4f8b\u5982\u90e8\u5206py\u5305\u4f1a\u5728setup\u65f6\u81ea\u52a8\u4e3a\u67d0\u4e9b\u6587\u4ef6\u52a0\u94fe\u63a5\uff0c\u800c\u8be5\u7a0b\u5e8f\u4f1a\u5c06symlink\u548c\u539f\u6587\u4ef6\u8ba4\u4e3a\u662f\u4e24\u4e2a\u6587\u4ef6\uff0c\u5220\u6389\u539f\u6587\u4ef6\u5e76\u6307\u5411symlink\uff0c\u5f62\u6210\u81ea\u73af\uff0c\u6587\u4ef6\u4e22\u5931\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u51e0\u5929\u7528depuGuru\u67e5\u4e86\u4e00\u4e0b\u7535\u8111\u91cc\u7684\u91cd\u590d\u6587\u4ef6\uff0c\u7136\u540e\u4e0d\u5047\u601d\u7d22\u5730\u8ba4\u4e3a\u6240\u6709\u7a0b\u5e8f\u90fd\u4f1ahandle symlink\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1780,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,24],"tags":[73,72],"class_list":["post-1778","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows","category-24","tag-bug","tag-72"],"_links":{"self":[{"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=\/wp\/v2\/posts\/1778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1778"}],"version-history":[{"count":5,"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=\/wp\/v2\/posts\/1778\/revisions"}],"predecessor-version":[{"id":1804,"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=\/wp\/v2\/posts\/1778\/revisions\/1804"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=\/wp\/v2\/media\/1780"}],"wp:attachment":[{"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sukasuka.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}