PDA

View Full Version : Read Files in the order of creation date


teognost
08-25-2009, 11:28 AM
I have a folder containing some sql files and I need to read these files one by one and add their content into a single file name update.sql
In order to achieve this I used a “Process files “ step which will find all the SQL scripts ,read them and write them into update.sql
I attached a sample of the project
Now a new requirement appeared –to read and write sql scripts in the order of creation date .
So based on file creation date –I need to take the oldest file and write it into update.sql ,then the next one created and so one.
I think the process file step take the files in random order ,is there any way to change that ?
Or how can I achieve such a thing to be done ?
Problem is when I look at the file properties –more relevant seems to me “Modified” section than “Created” section as it is older.
Thanks for any help

kinook
08-25-2009, 12:38 PM
You would need to build up a list in the desired order and iterate over that with the Loop action.

teognost
08-27-2009, 07:02 AM
Ok,finally I am doing it this way -I create a text file containing the name of all the sql files ordered by last modification date ascending.Then i just read the text file line by line and write the content of every sql file into update.sql.
A sample of the project is attached,maybe someone else would need to sort files by date.