{"id":10583,"date":"2019-05-14T00:18:18","date_gmt":"2019-05-13T15:18:18","guid":{"rendered":"https:\/\/elleneast.com\/?p=10583"},"modified":"2019-05-14T20:20:41","modified_gmt":"2019-05-14T11:20:41","slug":"%e3%80%90vb-net%e3%80%91fluentftp-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f%ef%bc%88ftpwebrequest%e3%80%81webclient%e3%80%81webrequest-%e3%81%af%e4%bd%bf%e3%81%86%e3%81%aa%ef%bc%81","status":"publish","type":"post","link":"https:\/\/elleneast.com\/?p=10583","title":{"rendered":"\u3010VB.NET\u3011FluentFTP \u3092\u4f7f\u3063\u3066\u307f\u305f"},"content":{"rendered":"<p>\u300c<a href=\"https:\/\/elleneast.com\/?p=10516\" target=\"_blank\" rel=\"noopener noreferrer\">\u3010VB.NET\u3011FTP\uff1aWebException (550) \u30d5\u30a1\u30a4\u30eb\u304c\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093<\/a>\u300d\u306e\u6700\u5f8c\u306b\u66f8\u3044\u305f\u901a\u308a\u3001\u73fe\u5728\u3067\u306f System.Net \u306b\u5c5e\u3059\u308b\u4e0b\u8a18\u306e\u30af\u30e9\u30b9\u306e\u4f7f\u7528\u304c\u63a8\u5968\u3055\u308c\u3066<strong>\u3044\u307e\u305b\u3093<\/strong>\u3002<\/p>\n<ul>\n<li>FtpWebRequest<\/li>\n<li>WebClient<\/li>\n<li>WebRequest\uff08HttpWebRequest\uff09<\/li>\n<\/ul>\n<p>\u3067\u3001VB.NET \u3067 FTP \u3092\u884c\u3046\u624b\u6bb5\u3068\u3057\u3066\u3001FluentFTP \u3092\u4f7f\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u305f\u308f\u3051\u3067\u3059\uff08\u4ee5\u524d\u306f System.Net.FtpClient \u3068\u3057\u3066\u77e5\u3089\u308c\u3066\u3044\u305f\u3082\u306e\uff09\u3002<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_83 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u6b21<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/elleneast.com\/?p=10583\/#%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\" >\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/elleneast.com\/?p=10583\/#%E5%9F%BA%E6%9C%AC%E7%9A%84%E3%81%AA%E4%BD%BF%E3%81%84%E6%96%B9\" >\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<\/a><\/li><\/ul><\/nav><\/div>\n<h2 id=\"i-0\"><span class=\"ez-toc-section\" id=\"%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB\"><\/span>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Visual Studio \u306e\u4e0a\u90e8\u30e1\u30cb\u30e5\u30fc\u304b\u3089\uff3b\u30c4\u30fc\u30eb\uff3d\uff1e\uff3bNuGet \u30d1\u30c3\u30b1\u30fc\u30b8 \u30de\u30cd\u30fc\u30b8\u30e3\u30fc\uff3d\uff1e\uff3b\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u306e NuGet \u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u7ba1\u7406\uff3d\u3092\u9078\u629e\u3002<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/WPFNotifyIcon\/Hardcodet.NotifyIcon.Wpf_0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10312 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/WPFNotifyIcon\/Hardcodet.NotifyIcon.Wpf_0.png\" alt=\"\" width=\"683\" height=\"298\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/WPFNotifyIcon\/Hardcodet.NotifyIcon.Wpf_0.png 683w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/WPFNotifyIcon\/Hardcodet.NotifyIcon.Wpf_0-300x131.png 300w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\"><\/a><\/p>\n<p>\uff3b\u53c2\u7167\uff3d\u3092\u9078\u629e\u3057\u3066\u691c\u7d22\u30dc\u30c3\u30af\u30b9\u306b\u300cfluentftp\u300d\u3068\u5165\u529b\u3002FluentFTP \u304c\u898b\u3064\u304b\u3063\u305f\u3089\u9078\u629e\u3057\u3066\u3001\u53f3\u306e\u30da\u30a4\u30f3\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5148\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u3001\uff3b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\uff3d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10595 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_01.png\" alt=\"\" width=\"717\" height=\"550\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_01.png 717w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_01-300x230.png 300w\" sizes=\"auto, (max-width: 717px) 100vw, 717px\"><\/a><\/p>\n<p>\u4e0b\u56f3\u306e\u78ba\u8a8d\u30c0\u30a4\u30a2\u30ed\u30b0\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u3001\uff3bOK\uff3d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u958b\u59cb\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10593 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_02.png\" alt=\"\" width=\"486\" height=\"493\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_02.png 486w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_02-296x300.png 296w\" sizes=\"auto, (max-width: 486px) 100vw, 486px\"><\/a><\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u72b6\u6cc1\u304c\u51fa\u529b\u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10594 bigshadow\" src=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_03.png\" alt=\"\" width=\"666\" height=\"246\" srcset=\"https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_03.png 666w, https:\/\/elleneast.com\/wp\/wp-content\/uploads\/programming_topics\/FluentFTP\/FluentFtp_03-300x111.png 300w\" sizes=\"auto, (max-width: 666px) 100vw, 666px\"><\/a><\/p>\n<h2 id=\"i-1\"><span class=\"ez-toc-section\" id=\"%E5%9F%BA%E6%9C%AC%E7%9A%84%E3%81%AA%E4%BD%BF%E3%81%84%E6%96%B9\"><\/span>\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3067\u3059\u3002\uff08\u53c2\u8003\uff1a<a href=\"https:\/\/github.com\/robinrodricks\/FluentFTP#example-usage\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub \u2013 FluentFTP \u2013 Example Usage<\/a>\uff09<\/p>\n<pre class=\"lang:vbnet decode:true  \">' FTP \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u4f5c\u6210\nDim client As New FtpClient(var_Host)\n\n'\u30ed\u30b0\u30a4\u30f3\u8a8d\u8a3c\u306e\u6307\u5b9a\u3092\u3057\u306a\u3044\u5834\u5408\u306f\u3001\"anonymous\" \u304c\u4f7f\u308f\u308c\u308b\u3002\nclient.Credentials = New NetworkCredential(var_Username, var_Password)\n\n' \u30b5\u30fc\u30d0\u30fc\u3078\u306e\u63a5\u7d9a\u3092\u958b\u59cb\nclient.Connect()\n\n' var_ServerTestDirectory1 \u30d5\u30a9\u30eb\u30c0\u306e\u30d5\u30a1\u30a4\u30eb\u3068\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30ea\u30b9\u30c8\u3092\u53d6\u5f97\u3002\n' \u5909\u6570 var_ServerTestDirectory1 \u306e\u4e2d\u8eab\u306f \"\/DirectoryName\" \u3068\u3044\u3046\u5f62\u5f0f\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002\nFor Each item As FtpListItem in client.GetListing(var_ServerTestDirectory1)\n\n    Dim str As String = \"\u25a0\" &amp; item.FullName &amp; vbCrLf\n\n    ' \u30d5\u30a1\u30a4\u30eb\u306e\u5834\u5408\n    If item.Type = FtpFileSystemObjectType.File Then\n\t\n        ' \u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u3092\u53d6\u5f97\n        Dim size As Long = client.GetFileSize(item.FullName)\n        str &amp;= \"size:\" &amp; size.ToString &amp; vbCrLf\n\n    End If\n\t\n    ' \u30d5\u30a1\u30a4\u30eb\u307e\u305f\u306f\u30d5\u30a9\u30eb\u30c0\u306e\u66f4\u65b0\u65e5\u6642\u3092\u53d6\u5f97\n    Dim time As DateTime = client.GetModifiedTime(item.FullName)\n    str &amp;= \"time:\" &amp; time.ToString &amp; vbCrLf\n\t\n    ' \u30b5\u30fc\u30d0\u30fc\u5074\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u30cf\u30c3\u30b7\u30e5\u3092\u8a08\u7b97\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\uff09\n    '   \u30b5\u30fc\u30d0\u30fc\u304c Hash \u30b3\u30de\u30f3\u30c9\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u308b\u5834\u5408\u3001\n    '   FtpClient.HashAlgorithms \u30d5\u30e9\u30b0\u306f FtpHashAlgorithm.NONE \u306b\u306a\u3089\u306a\u3044\u3002\n    If client.HashAlgorithms &lt;&gt; FtpHashAlgorithm.NONE Then\n        Dim hash As FtpHash = client.GetHash(item.FullName)\n        str &amp;= \"hash:\" &amp; hash.Value &amp; vbCrLf\n    End If\n\n    MsgBox(str)\nNext\n\n' \u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\nMsgBox(\"Upload\")\nclient.UploadFile(\"D:\\temp\\test.txt\", var_ServerTestDirectory1 &amp; \"\/Uploaded.txt\")\n\n' \u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u30ea\u30cd\u30fc\u30e0\nMsgBox(\"Rename\")\nclient.Rename(var_ServerTestDirectory1 &amp; \"\/Uploaded.txt\", var_ServerTestDirectory1 &amp; \"\/Renamed.txt\")\n\n' \u4eca\u5ea6\u306f\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\nMsgBox(\"Download\")\nclient.DownloadFile(\"D:\\temp\\Downloaded.txt\", var_ServerTestDirectory1 &amp; \"\/Renamed.txt\")\n\n' \u30b5\u30fc\u30d0\u30fc\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\nMsgBox(\"Delete file\")\nclient.DeleteFile(var_ServerTestDirectory1 &amp; \"\/Renamed.txt\")\n\n' \u30b5\u30fc\u30d0\u30fc\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u518d\u5e30\u7684\u306b\u524a\u9664\nMsgBox(\"Delete directory\")\nclient.DeleteDirectory(var_ServerTestDirectory1 &amp; \"\/\")\n\n' \u30b5\u30fc\u30d0\u30fc\u306b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u5b58\u5728\u3059\u308b\u304b\u30c1\u30a7\u30c3\u30af\nMsgBox(\"Directory Exists\")\nMsgBox(client.DirectoryExists(var_ServerTestDirectory2).ToString)\n\n' \u30b5\u30fc\u30d0\u30fc\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u304b\u30c1\u30a7\u30c3\u30af\nMsgBox(\"File Exists\")\nMsgBox(client.FileExists(var_ServerTestDirectory2 &amp; \"\/test2.txt\").ToString)\n\n' \u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3002\u5931\u6557\u3057\u305f\u5834\u5408\u306f\uff13\u56de\u307e\u3067\u8a66\u884c\u3059\u308b\u3002\nMsgBox(\"Upload - RetryAttempts\")\nclient.RetryAttempts = 3\nclient.UploadFile(\"D:\\temp\\test.txt\", var_ServerTestDirectory2 &amp; \"\/Uploaded.txt\", FtpExists.Overwrite, false, FtpVerify.Retry)\n\n' \u5207\u65ad\u3002\u307e\u305f\u306d\uff01\nMsgBox(\"Bye!\")\nclient.Disconnect()\n\n'\u7834\u68c4\uff08\u5207\u65ad\u3082\u884c\u3046\uff09\u3002\nclient.Dispose <\/pre>\n<p>&nbsp;<\/p>\n<div>\n<p>\u66f4\u306b\u8a73\u7d30\u306a\u30b5\u30f3\u30d7\u30eb\uff08C#\uff09\u304c <a href=\"https:\/\/github.com\/robinrodricks\/FluentFTP\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub \u2013 FluentFTP<\/a> \u306b\u7f6e\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u300c\u3010VB.NET\u3011FTP\uff1aWebException (550) \u30d5\u30a1\u30a4\u30eb\u304c\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u300d\u306e\u6700\u5f8c\u306b\u66f8\u3044\u305f\u901a\u308a\u3001\u73fe\u5728\u3067\u306f System.Net \u306b\u5c5e\u3059\u308b\u4e0b\u8a18\u306e\u30af\u30e9\u30b9\u306e\u4f7f\u7528\u304c\u63a8\u5968\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 FtpWebRequest  &#8230; <\/p>\n","protected":false},"author":1,"featured_media":2656,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[57],"tags":[60],"class_list":{"0":"post-10583","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-57","8":"tag-vb-net"},"_links":{"self":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/10583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10583"}],"version-history":[{"count":3,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/10583\/revisions"}],"predecessor-version":[{"id":10619,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/posts\/10583\/revisions\/10619"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=\/wp\/v2\/media\/2656"}],"wp:attachment":[{"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elleneast.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}