<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Copy to directory - match left 5 characters in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302890#M74825</link>
    <description>I tried using tFileList but I was unable to fetch exact folder name using wild card search.&lt;BR /&gt;Could you please elaborate?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Zaki.</description>
    <pubDate>Mon, 19 Dec 2016 13:01:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-12-19T13:01:42Z</dc:date>
    <item>
      <title>Copy to directory - match left 5 characters</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302887#M74822</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;&lt;BR /&gt;I have to copy (tFileCopy) files to directories but I only know the 5 first characters of directories names.&lt;BR /&gt;&lt;BR /&gt;context.path_10000 + "/" + (globalMap.get("no_bon_commande")&lt;BR /&gt;&lt;BR /&gt;My "no_bon_commande" is like "22345" and directory name can be "22345 - General folder for XXXX")&lt;BR /&gt;&lt;BR /&gt;What do I have to add to copy to the final directory? I tried left ("no_bon_commande),5), etc.... without succes&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;&lt;BR /&gt;Martin&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 13:47:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302887#M74822</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-15T13:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Copy to directory - match left 5 characters</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302888#M74823</link>
      <description>Hi Martin, 
&lt;BR /&gt;I have a solution to your problem. Since I am not good in Java&amp;nbsp; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MAB6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158321i00588DF41617C922/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MAB6.png" alt="0683p000009MAB6.png" /&gt;&lt;/span&gt;, I have implemented the solution to your problem using windows batch scripting and Talend. 
&lt;BR /&gt;The overall process is as follows: 
&lt;BR /&gt;[list=1] 
&lt;BR /&gt; 
&lt;LI&gt;Write a bat script or respective commands in tSystem component where we will find the folder starting with 5 wild card characters as per your problem statement. Copy the output in a txt file (code this part in the same batch script).&amp;nbsp;&lt;/LI&gt; 
&lt;BR /&gt; 
&lt;LI&gt;Now, read this file (On subjob OK), pull only line 4 (tSampleRow) as the folder name for which we are interested will be present at this line always, find the folder name using tMap string handling functions as explained below which will give us the exact folder name and copy the output to a context variable using tContextLoad.&lt;/LI&gt; 
&lt;BR /&gt; 
&lt;LI&gt;Finally, use tFileCopy to copy your file and in the destination parameter, concat the path with the context variable which we loaded in step #2.&lt;/LI&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Batch script: 
&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt; 
&lt;BR /&gt;cd &amp;lt;Path to the parent directory in which we have our sub directories from which we need to select proper directory for dumping our file by using only first 5 letters&amp;gt; 
&lt;BR /&gt;dir abcde* /s /p &amp;gt; &amp;lt;path and file name of the file where we want to write the output of this batch script&amp;gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Here, &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt; is the directory which contains sub folders where I want to copy my files. 
&lt;BR /&gt;abcdefg is the directory where I want to copy my file and so I have only written abcde* in the code as per your problem statement. 
&lt;BR /&gt; 
&lt;BR /&gt;tMap expression for step #2: 
&lt;BR /&gt; 
&lt;BR /&gt;StringHandling.EREPLACE(StringHandling.EREPLACE(row11.Col1," ","") ,StringHandling.LEFT(StringHandling.EREPLACE(row11.Col1," ","") ,StringHandling.INDEX(StringHandling.EREPLACE(row11.Col1," ",""),"&amp;gt;")+1 ),"") 
&lt;BR /&gt; 
&lt;BR /&gt;col1 is the output column from tSamleRow.&amp;nbsp; 
&lt;BR /&gt;You will see value for this field as&amp;nbsp;19-12-1601:50PM&amp;lt;DIR&amp;gt;abcdefg where abcdefg is the folder where I need to copy my file. 
&lt;BR /&gt;Here, I am first removing all the blank spaces, followed by eliminating all the unwanted characters to fetch the desired folder name (abcdefg). 
&lt;BR /&gt;&amp;nbsp; 
&lt;BR /&gt;Attached is the Job screenshot for your reference. 
&lt;BR /&gt; 
&lt;BR /&gt;I know this is not a complete dynamic solution but at least this will give you some idea from where you can proceed. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MG7n.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/145484iC256DED727EF8EEA/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MG7n.png" alt="0683p000009MG7n.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Mon, 19 Dec 2016 12:26:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302888#M74823</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-19T12:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Copy to directory - match left 5 characters</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302889#M74824</link>
      <description>Hi,&lt;BR /&gt;You may also use tFileList to get complete folder name then you can use tFileCopy.&lt;BR /&gt;Is it clear for you?&lt;BR /&gt;Regards,&lt;BR /&gt;TRF</description>
      <pubDate>Mon, 19 Dec 2016 12:57:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302889#M74824</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2016-12-19T12:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Copy to directory - match left 5 characters</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302890#M74825</link>
      <description>I tried using tFileList but I was unable to fetch exact folder name using wild card search.&lt;BR /&gt;Could you please elaborate?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Zaki.</description>
      <pubDate>Mon, 19 Dec 2016 13:01:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302890#M74825</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-19T13:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Copy to directory - match left 5 characters</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302891#M74826</link>
      <description>Hi
&lt;BR /&gt;
&lt;BR /&gt;I also try to fetch folders name with tFileList
&lt;BR /&gt;
&lt;BR /&gt;context.chemin_10000 + "/" + LEFT(globalMap.get("tFileList_4"),5)
&lt;BR /&gt;
&lt;BR /&gt;without succes.
&lt;BR /&gt;
&lt;BR /&gt;By the way, this way will not help me to match with my "no_bon_commande" var
&lt;BR /&gt;
&lt;BR /&gt;Martin</description>
      <pubDate>Mon, 19 Dec 2016 15:34:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302891#M74826</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-19T15:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Copy to directory - match left 5 characters</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302892#M74827</link>
      <description>Did you try this?
&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MG7s.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/130631iC709170EDCE1F9E3/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MG7s.png" alt="0683p000009MG7s.png" /&gt;&lt;/span&gt;
&lt;BR /&gt;Regards,
&lt;BR /&gt;TRF</description>
      <pubDate>Mon, 19 Dec 2016 15:50:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302892#M74827</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2016-12-19T15:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Copy to directory - match left 5 characters</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302893#M74828</link>
      <description>Hi 
&lt;BR /&gt; 
&lt;BR /&gt;You have two tFileList in your example:1 and 4 
&lt;BR /&gt;What do you do before with tFileList_4? 
&lt;BR /&gt; 
&lt;BR /&gt;My job is actually this: 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MG7x.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/148401i2DE8D90B1FCFA11A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MG7x.png" alt="0683p000009MG7x.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;Martin</description>
      <pubDate>Mon, 19 Dec 2016 16:28:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302893#M74828</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-19T16:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Copy to directory - match left 5 characters</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302894#M74829</link>
      <description>TRF
&lt;BR /&gt;It doesn't seem to be possible to do a LEFT on an object (directory list).
&lt;BR /&gt;Other ideas?
&lt;BR /&gt;Martin</description>
      <pubDate>Tue, 03 Jan 2017 15:40:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302894#M74829</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-03T15:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Copy to directory - match left 5 characters</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302895#M74830</link>
      <description>Hi
&lt;BR /&gt;Ok, just got it: Filemask
&lt;BR /&gt;"([0-9]{5})" + ".*"
&lt;BR /&gt;Martin</description>
      <pubDate>Wed, 04 Jan 2017 13:53:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Copy-to-directory-match-left-5-characters/m-p/2302895#M74830</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-04T13:53:54Z</dc:date>
    </item>
  </channel>
</rss>

