topic Re: Exclude File Mask in TFTPFileList in Design and Developmenthttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/125140#M78600
<P>Thank You for your reply. I did figure it out by trial error. I guess I should have posted my solution earlier as well. I basically did the same as you illustrated in your response, however the only difference is: you did:</P><PRE>System.out.println(s);</PRE><P>&nbsp;whereas I just:</P><PRE>continue;</PRE><P>as I did not want anything to print out. However, thank you for your response as this not only just confirms my trial and error method of excluding files but can help others in the future.&nbsp;</P>Mon, 25 Jun 2018 13:54:37 GMTsai06kiran2018-06-25T13:54:37ZExclude File Mask in TFTPFileListhttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/124806#M78442
<P>Hello,</P><P>&nbsp;</P><P>I am using the TFTPFileList component, but unlike the TFileList component which has exclude file mask option in advance settings, I do not see this option in the TFTPFileList component. I want to exclude all the "xml" files and files with certain substrings that I am transferring from my remote file system to Hbase. Is there a way I can do this without storing any files or scripts on my local computer through which Talend is running? I would appreciate any help asap!</P><P>&nbsp;</P><P>Thanks!</P>Sun, 22 Jul 2018 09:00:52 GMThttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/124806#M78442sai06kiran2018-07-22T09:00:52ZRe: Exclude File Mask in TFTPFileListhttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/124807#M78443
<P>By the way I have a large number of files of different formats, and so I would really like to exclude just the xml files then to include all the 100 other files with different formats.</P>Thu, 21 Jun 2018 17:31:48 GMThttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/124807#M78443sai06kiran2018-06-21T17:31:48ZRe: Exclude File Mask in TFTPFileListhttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/125139#M78599
<P>One way of achieving this would be to use Java code to filter out the files which you don't want to process in your subsequent steps.<BR /><BR /></P><P>Code for tJava -</P><PRE>String s = ((String)globalMap.get("tFTPFileList_1_CURRENT_FILE")).substring(StringHandling.INDEX( ((String)globalMap.get("tFTPFileList_1_CURRENT_FILE")),".")).trim();
if(!s.equals(".xml")){
System.out.println(s);
context.fileName = ((String)globalMap.get("tFTPFileList_1_CURRENT_FILE"));
globalMap.put("tFTPFileProperties_2_FILENAME", null);
}</PRE><P>The above could would make sure that the immediate next component of tJava (in my example (tFTPFileProperties) won't receive the any xml file as part of it's iteration.</P><P>&nbsp;</P><P>Sample job flow -&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tFTP-2.JPG" style="width: 428px;"><img src="https://yutwg22796.i.lithium.com/t5/image/serverpage/image-id/10554iE2FF115CA09AB727/image-size/large?v=1.0&amp;px=999" title="tFTP-2.JPG" alt="tFTP-2.JPG" /></span></P><P>&nbsp;</P><P>tFTPFileProperties settings -&nbsp;</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tFTP-3.JPG" style="width: 730px;"><img src="https://yutwg22796.i.lithium.com/t5/image/serverpage/image-id/10555iB844E953841DB5CA/image-size/large?v=1.0&amp;px=999" title="tFTP-3.JPG" alt="tFTP-3.JPG" /></span></P>Mon, 25 Jun 2018 13:40:30 GMThttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/125139#M78599iamabhishek2018-06-25T13:40:30ZRe: Exclude File Mask in TFTPFileListhttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/125140#M78600
<P>Thank You for your reply. I did figure it out by trial error. I guess I should have posted my solution earlier as well. I basically did the same as you illustrated in your response, however the only difference is: you did:</P><PRE>System.out.println(s);</PRE><P>&nbsp;whereas I just:</P><PRE>continue;</PRE><P>as I did not want anything to print out. However, thank you for your response as this not only just confirms my trial and error method of excluding files but can help others in the future.&nbsp;</P>Mon, 25 Jun 2018 13:54:37 GMThttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/125140#M78600sai06kiran2018-06-25T13:54:37ZRe: Exclude File Mask in TFTPFileListhttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/129448#M80924
<P>Hi,&nbsp;</P><P>&nbsp;</P><P>I'm having the same problem, of missing the Exluding Filemask in tFTPFileList, but this JavaCode is nog working for me..&nbsp;</P><P>I tried it exactly the same as you put it, except that my next component is a tFTPGet, but all the files go through.. it doesn't stop the ones that should be excluded.&nbsp;</P><P>&nbsp;</P><P>Am I doing something wrong?&nbsp;</P><P>I would like some more help here, cause I'm getting desperate with my job.&nbsp;</P><P>&nbsp;</P><P>Thanks in advance!</P>Fri, 03 Aug 2018 14:13:25 GMThttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/129448#M80924Annewieke2018-08-03T14:13:25ZRe: Exclude File Mask in TFTPFileListhttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/129476#M80934
<P>Hi,</P><P>&nbsp;</P><P>Let us consider your TFTPFileList is named : "<SPAN>tFTPFileList_1"</SPAN></P><P>&nbsp;</P><P>So for example if I wanted to exclude all that ended with "xml", in my java component, I coded: if(((String)globalMap.get("tFTPFileList_1_CURRENT_FILEPATH")).endsWith(".xml")) {</P><P>&nbsp; &nbsp; &nbsp; continue;</P><P>}</P><P>&nbsp;</P><P>or if I wanted to exclude all the files that begin with "sony", than in my java component, I coded:</P><P>if(((String)globalMap.get("tFTPFileList_1_CURRENT_FILEPATH")).startsWith("sony")) {</P><P>&nbsp; &nbsp; &nbsp; continue;</P><P>}</P><P>&nbsp;</P><P>This java component will be attached right after your TFTPFileList in order to disregard the files you do not want to pass into your FTPGet.&nbsp;</P><P>You will have to figure out a regex in java to parse/obtain the filenames of your files like the ones above (i.e. startsWith("") or contains(""), etc<img id="smileywink" class="emoticon emoticon-smileywink" src="https://yutwg22796.i.lithium.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /> to disregard the corresponding files you wish.</P><P>&nbsp;</P><P>Next create a context variable named, say: filename</P><P>&nbsp;</P><P>Next, connect another java component to this first java component and input the following code:</P><P>context.filename = ((String)globalMap.get("<SPAN>tFTPFileList_1_CURRENT_FILE"));</SPAN></P><P>&nbsp;</P><P><SPAN>Now connect this to your TFTPGet component. Fill in the details of the local and remote directory of the TFTPGet Component. Finally, in your Filemask of TFTPGet component, add the context.filename as a "Files" parameter.</SPAN></P><P>&nbsp;</P><P><SPAN>This should get your desired files.</SPAN></P><P><SPAN>Hope this helps!</SPAN></P>Fri, 03 Aug 2018 23:12:52 GMThttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/129476#M80934sai06kiran2018-08-03T23:12:52ZRe: Exclude File Mask in TFTPFileListhttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/129477#M80935
Hi,<BR /><BR /><BR /><BR />Let us consider your TFTPFileList is named : "tFTPFileList_1"<BR /><BR /><BR /><BR />So for example if I wanted to exclude all that ended with "xml", in my java component, I coded: if(((String)globalMap.get("tFTPFileList_1_CURRENT_FILEPATH")).endsWith(".xml")) {<BR /><BR />continue;<BR /><BR />}<BR /><BR /><BR /><BR />or if I wanted to exclude all the files that begin with "sony", than in my java component, I coded:<BR /><BR />if(((String)globalMap.get("tFTPFileList_1_CURRENT_FILEPATH")).startsWith("sony")) {<BR /><BR />continue;<BR /><BR />}<BR /><BR /><BR /><BR />This java component will be attached right after your TFTPFileList in order to disregard the files you do not want to pass into your FTPGet.<BR /><BR />You will have to figure out a regex in java to parse/obtain the filenames of your files like the ones above (i.e. startsWith("") or contains(""), etcSmiley Wink to disregard the corresponding files you wish.<BR /><BR /><BR /><BR />Next create a context variable named, say: filename<BR /><BR /><BR /><BR />Next, connect another java component to this first java component and input the following code:<BR /><BR />context.filename = ((String)globalMap.get("tFTPFileList_1_CURRENT_FILE"));<BR /><BR /><BR /><BR />Now connect this to your TFTPGet component. Fill in the details of the local and remote directory of the TFTPGet Component. Finally, in your Filemask of TFTPGet component, add the context.filename as a "Files" parameter.<BR /><BR /><BR /><BR />This should get your desired files.<BR /><BR />Hope this helps!Fri, 03 Aug 2018 23:14:22 GMThttps://community.talend.com/t5/Design-and-Development/Exclude-File-Mask-in-TFTPFileList/m-p/129477#M80935sai06kiran2018-08-03T23:14:22Z