[Tutor] Reading matching text files in a folder
Schmidt, Allen J.
aschmidt@nv.cc.va.us
Tue, 30 Oct 2001 09:39:55 -0500
I've been lurking for a while but now need some help...
I have a program that reads a hard-coded filename and path like
"F:\\import\\20011030-Tue.txt"
It works and breaks each line up into parts, strips out apostrophes and
inserts the fields into a MySQL database table.
What I need to be able to do:
Look into the above folder (F:\\import\\) and see if there are any *.txt
files in it.
If so, pass it by name into my loop that breaks it up and does the DB
insert.
I also need access to the date (20011030) and the day (Tue) to use as fields
in the insert.
Then when done, rename the file by adding some prefix and suffix so it is
not processed again the next day.
AND...if there is more than one, loop through each of them in turn and
perform the above needed actions.
Have not worked with files much and need some guidance. Links to examples
also appreciated.
Thanks
Allen