Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am creating a .csv data import project to a postgresql database. and I want to add a new column that takes the name of the folder where the file is being collected, it is possible to do it, and how can I do it.
I am using tFileList to recover the files in the specific folder and save all the files in the same table.
please help me
This is quite an easy requirement to fulfil given you are already using the tFileList. All you need to do is add a tMap component somewhere in the flow after the tFileList. Then add a "folder" column. The folder column, you would simply use to one of these globalMap variables....
((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))
((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
thank you, but with
((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
i have the name of file data.
and with
((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))
All directory ex: C:\User\Documents\data\info.
i need only the name of folder
Given the example in your last post, would your folder name be "info"? If so, all you need to do is extract "info" from this variable. Some code to do that can be seen below...
String path = "C:\\User\\Documents\\data\\info"; String folder = path.substring(path.lastIndexOf('\\')+1);