{"id":3192,"date":"2012-06-26T12:07:12","date_gmt":"2012-06-26T10:07:12","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=3192"},"modified":"2013-07-23T09:54:13","modified_gmt":"2013-07-23T07:54:13","slug":"ftp-uploading-files-using-patterns","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/ftp-uploading-files-using-patterns","title":{"rendered":"FTP uploading files using patterns"},"content":{"rendered":"<p>Uploading files using <strong>patters <\/strong>is a unique feature of our <a href=\"\/ftp\">FTP component<\/a>. It allows you fast upload of files of certain types.<\/p>\n<p>Here&#8217;s the sample that uploads all text files (*.txt) files from C drive, to newly created &#8216;Uploads&#8217; folder on FTP server. The search includes <strong>all child folders recursively<\/strong> &#8211; note the <em>true<\/em> parameter in <em>LocalSearchOptions<\/em> constructor. Ftp component is going to<strong> create all necessary folders<\/strong> on the remote FTP server for you.<\/p>\n<h2>Upload using wildcard pattern<\/h2>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nusing (Ftp ftp = new Ftp())\r\n{\r\n    ftp.Connect(&quot;ftp.example.com&quot;);    \/\/ or ConnectSSL\r\n\r\n    ftp.CreateFolder(&quot;Uploads&quot;);\r\n\r\n    LocalSearchOptions options = new LocalSearchOptions(&quot;*.txt&quot;, true);\r\n    ftp.UploadFiles(&quot;Uploads&quot;, @&quot;c:\\&quot;, options);\r\n\r\n    ftp.Close();\r\n}\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nUsing ftp As New Ftp()\r\n    ftp.Connect(&quot;ftp.example.com&quot;)\t' or ConnectSSL\r\n    ftp.CreateFolder(&quot;Uploads&quot;)\r\n\r\n    Dim options As New LocalSearchOptions(&quot;*.txt&quot;, True)\r\n    ftp.UploadFiles(&quot;Uploads&quot;, &quot;c:\\&quot;, options)\r\n\r\n    ftp.Close()\r\nEnd Using\r\n<\/pre>\n<h2>Upload using regex pattern<\/h2>\n<p>You can also use <em>LocalSearchOptions.UseRegexMatch<\/em> method, if you want to use <strong>regex patterns<\/strong>:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nusing (Ftp ftp = new Ftp())\r\n{\r\n    ftp.Connect(&quot;ftp.example.com&quot;);    \/\/ or ConnectSSL\r\n\r\n    ftp.CreateFolder(&quot;Uploads&quot;);\r\n\r\n    LocalSearchOptions options = new LocalSearchOptions();\r\n    options.UseRegexMatch(@&quot;^.*$&quot;, @&quot;^.*\\.txt$&quot;, true);\r\n    ftp.UploadFiles(&quot;Uploads&quot;, @&quot;c:\\&quot;, options);\r\n\r\n    ftp.Close();\r\n}\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nUsing ftp As New Ftp()\r\n    ftp.Connect(&quot;ftp.example.com&quot;)\t' or ConnectSSL\r\n\r\n    ftp.CreateFolder(&quot;Uploads&quot;)\r\n\r\n    Dim options As New LocalSearchOptions()\r\n    options.UseRegexMatch(&quot;^.*$&quot;, &quot;^.*\\.txt$&quot;, True)\r\n    ftp.UploadFiles(&quot;Uploads&quot;, &quot;c:\\&quot;, options)\r\n\r\n    ftp.Close()\r\nEnd Using\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Uploading files using patters is a unique feature of our FTP component. It allows you fast upload of files of certain types. Here&#8217;s the sample that uploads all text files (*.txt) files from C drive, to newly created &#8216;Uploads&#8217; folder on FTP server. The search includes all child folders recursively &#8211; note the true parameter [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[22,80],"class_list":["post-3192","post","type-post","status-publish","format-standard","hentry","category-ftp-dll","tag-ftp","tag-ftp-component"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/3192"}],"collection":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/comments?post=3192"}],"version-history":[{"count":9,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/3192\/revisions"}],"predecessor-version":[{"id":4166,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/3192\/revisions\/4166"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=3192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=3192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=3192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}