Forum Discussion
Hi Amar,
Sorry for the delay. I was thinking more about your scenario, and I think I have a better suggestion. Since you may not need to “poll” for the files, I am thinking a different Snap would be better.
Say I want to boil the problem down to grabbing the files, and then deleting them…You could use a MultiFileReader Snap, with a file filter to get the desired types of file. The output will be a binary data stream.
You could connect this to a BinaryToDocument Snap and then perform operations on that document. At some point you would need to use a Mapper to key on the filename and pass that to a FileDelete Snap.
For the simpler case of just say…reading files and deleting them for proof of concept, you could use a DirectoryBrowser instead of the MultiFileReader. The DirectoryBrowser would return you attributes about all of the files that match the type filter (essentially a List in document format versus binary). Then you’d plug this into a Mapper Snap, to map the filename. Then you’d plug this into a Delete Snap where you configure it to read the file name from the mapped variable.
I hope this helps you get further towards your goal!
Thanks,
-Charlie
I want to know list of columns using expression in mapper snap.
- When I write $.keys() expression its fetching all the columns for all the rows which to performance issue. I need only first document or first row.How are you using those columns downstream from the mapper? One performance improvement would be to only do the call to $.keys() once and use that information. However if you need to join it with each document, then I'm not sure that would improve anything. If you only use it in some kind of load/write operation, then maybe that would be an improvement for you.