Page 1 of 1

Passing multiple filenames one after another

Posted: Wed Apr 20, 2011 7:21 am
by mac4rfree85
HI Guys,

I have multiple files in a location. Now i need to process each file one after the another.

So, i need to pass the file names one after the another to a sequence.

Can you guys help me with this.

Cheers!!!!

Posted: Wed Apr 20, 2011 7:24 am
by vinothkumar
Get all the file names through execute command stage. Use loop stage to process all files one by one by sending the file names.

Posted: Wed Apr 20, 2011 7:24 am
by chulett
What have you tried? That's exactly what the Start/End Loop stages are for, all you need to do is build them a delimited list of the filenames first.

Posted: Wed Apr 20, 2011 7:27 am
by mac4rfree85
I created a Execute command stage with "ls /path/Text*.txt" command in it.
Now How to pass it to the Start Loop Activity stage?

Posted: Wed Apr 20, 2011 7:29 am
by chulett
That by itself won't work as the list needs to be delimited. Typically you would use a User Variables Activity stage to generate the list and your O/S should have an "m" option (off the top of my head) to return your list of filenames comma delimited.

Posted: Wed Apr 20, 2011 8:10 am
by rameshrr3
Is the order in which files were created in the directory important ?

one possible option is to use

Code: Select all

ls -m /path/Text*.txt
And in an user variable stage use

Trailing field marks from command output need to be removed or else they can create problems..

Code: Select all

uv= FileListConvert(@FM,"",ExecCmd.$Command_Output) 
use this variable in the start loop , specifying comma as the delimiter.


Disclaimer : Some commands may not behave the same way in all platforms. Use discretion