Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping through files sorted by date 1

Status
Not open for further replies.

HoustonGuy

Programmer
Jun 29, 2000
165
0
0
US
Can't seem to crack this problem, so I'm calling out to my brothers and sisters here.

I'm looping through files for a loading procedure, but need to load them sorted by modified date. (Ascending, so the oldest file loads first.)

Any help is most appreciated.
:)
 
Only thing I can think of is to do a double (or 3rd) pass of the files. On the first pass get the modified date using a script task and add to the filename the date (also store the new filename else where for later reference) i.e. "myfile20110218" then once you have modified filename process the files again using the stored data (sorted ofc).

So for clarity:
1. loop though the files and rename the files while storing the filename in a table or whatever (I just changed the filename on my pc and the modified date did not change)
2. loop though the files based on the filename matching the stored filenames that you will have sorted.
(if needed) 3. loop again to remove the filename.



I feel sorry for people who don't drink, when they wake up in the morning that's as good as the're going to feel all day!
 
Thanks.
I have thought of this, but have not found the object reference to retrieve the modified date of each file. I know it is a property, or properties value, (by name or index), but haven't worked it out yet to return the modified date yet.

The only other option I found was to list the file names in a text file, in the order I want them loaded. Then loop through the text file and load each sequentially.
 
I should clarify that the file names in the text file are just labels to be concatenated into a full path to the actual file.
 
Hey,

This looks to be along the lines of what you need
You could load the file names into a text file and use this a lookup document and it would work. The issue I see with this is that you have to maintain the file (I have having to do this ;p).

/Nice

I feel sorry for people who don't drink, when they wake up in the morning that's as good as the're going to feel all day!
 
My apologies Nice, for the extreme delay.
I appreciate the link. Looks like exactly what I need!

Thanks again!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top