How to make a list of files in a folder directory
Posted: Tue Sep 18, 2012 12:48 pm
Here's my latest challenge, scan a folder and make a list of the files for a particular file type. For example a make a list of all the *.dbf files in a particular folder. Because once I have that list I'm going to loop through and make an ODBC connection to that file and extract the data that I want. I will never know how many files are going to be in the folder and all I need is the file name. Bonus if I can use the date modified of the file to determine if I should add it to the list since the last run time of my job.
I know there is a Folder Stage but I haven't ever used it but I believe it takes two columns: file name, file data. Can that stage do a recursive search if I also need to scan sub folders?
Another way I thought of doing it is writing a linux script that data stage calls and have the OS do the work of making a CSV of file names for data stage to use.
Does anyone have any insight or pointers?
I know there is a Folder Stage but I haven't ever used it but I believe it takes two columns: file name, file data. Can that stage do a recursive search if I also need to scan sub folders?
Another way I thought of doing it is writing a linux script that data stage calls and have the OS do the work of making a CSV of file names for data stage to use.
Does anyone have any insight or pointers?