Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
NNot_defined1679394540

browse a directory to populate a database

Hi, I would like to create a job which consumes the xml which is a directory and loads them into a mysql database, but I wonder if with TOS we can be able to browse a directory and retrieve the data from the XML found in the directory and load them into the database? If it is possible to browse a directory with component, do we do it?

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

You can use tFileList component to iterates a set of files or folders in a given directory based on a filemask pattern, here is a scenario.

https://help.talend.com/r/en-US/8.0/tfilelist/tfilelist-tfileinputdelimited-tlogrow-tlogrow-iterating-on-file-directory-standard-component-the

 

Regards

Shong

View solution in original post

8 Replies
Anonymous
Not applicable

Hi

You can use tFileList component to iterates a set of files or folders in a given directory based on a filemask pattern, here is a scenario.

https://help.talend.com/r/en-US/8.0/tfilelist/tfilelist-tfileinputdelimited-tlogrow-tlogrow-iterating-on-file-directory-standard-component-the

 

Regards

Shong

NNot_defined1679394540
Author

okay I followed a lot of courses so I took as input a tfileList and a tfileinputXml, a tmap then a toutputDB but the difficulty I currently have is that when I connect the tfileList to the tfileinputxml with an iterate line so that it loops over the entire folder the tfileinputXml disappears
Anonymous
Not applicable

Sorry, I don't understand your problem here, tfileinputXml disappears?

A simple job design looks like:

tFileList--iterate--tFileInputXML--main--tDBOutput

 

 

NNot_defined1679394540
Author

obviously the path is as presented here but when it is necessary to iterate the link between the tfileList and the TfileinputXml, the output component disappears
NNot_defined1679394540
Author

by reflex I removed the tfileList that was there and I replaced it with another, everything works correctly. Thank you very much
NNot_defined1679394540
Author

in my tfileinputxml I cannot loop the files when I just put the simple directory I get the error access denied but if I put the name of the first file in the hope that it takes the others after it does not loop only on the first file
Anonymous
Not applicable

@Not defined Not defined​ If you are using a tFlieList to iterate multiple files one by one, there is a global variable that stores the current file path,

((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))

So, use this global variable in the File name/Stream field on tFileInputXML.

 

NNot_defined1679394540
Author

thank you it works correctly