borland findfirst not sorting by file age

B

bmshirey

I have a program which manages various log files of multiple
extensions. The program needs to delete files based on an age paramter
and a file number limit paramter. So if files are older than say a week
they get deleted, and if my max file number limit is 1000 and I have
1200, I delete 200 files, starting with the oldest. Findfirst and
findnext work great for putting the files into a list when there is
only one file type. They will load them from oldest to youngest, thus
they are sorted and all I do is start deleting from the beginning of
the list. However when I have more than one file type in my directory
it doesn't load them by age. It first loads all of one type of file,
oldest to youngest, then all of the next type of file, oldest to
youngest and so on. So if I try to trim them down to be under my max
file limit I end up deleting all of the first type of file, even if
they are younger than some of the second type. Obviously I could make
my own list by looping through all the first and doing a sort, but this
seems to time consuming. Eventually this program will manage thousands
of files all at once and this routine runs in a loop about once a
second, so adding another loop to go through and sort 10,000+ files
will probably be too time consuming.

Does anyone know of an alternative to findfirst/findnext that will work
in borland win32 and sort files by age only and will work with
thousands of files?
 
V

Victor Bazarov

bmshirey said:
[...]
Does anyone know of an alternative to findfirst/findnext that will work
in borland win32 and sort files by age only and will work with
thousands of files?

Your question is off-topic here. Please post it to a Borland or to
a Win32 programming newsgroup.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top