How tio remove the extension from file and copy it

One Star

How tio remove the extension from file and copy it

Hi ,
I am new to talend,
I need to read the multiple file in a folder , File name is with extension for instance (category.csv)
after read and load the data into table , i need copy the source file without the extension and put it into target directory. so what i did was
On component ok
tfilelist------tfileinputdelimited------tmap----toracleoutput-------------------------TFilecopy
the below expression i written in tfilecopy in destination filename
StringHandling.LEFT(((String)globalMap.get("tFileList_1_CURRENT_FILE")),6)
The above expression working in the case if the file contains 6 characters ,
if its more than that its not working, so i need to do this dynamically any help.......
Community Manager

Re: How tio remove the extension from file and copy it

Hi
Try this expression
((String)globalMap.get("tFileList_1_CURRENT_FILE")).substring(0, file.indexOf("."))
----------------------------------------------------------
Talend | Data Agility for Modern Business
Employee

Re: How tio remove the extension from file and copy it

Below Expression worked for me:

 

StringHandling.LEFT(((String)globalMap.get("tFileList_1_CURRENT_FILE")),StringHandling.INDEX(((String)globalMap.get("tFileList_1_CURRENT_FILE")),"."))

 

 

Best Regards,

Ram