Heres what I am trying to do: I have a load of HTML files sorted into days, ie. One for each day, and I have them in a directory structure with one directory for each day of the month, all contained within one directory, and liikewise all months in one directory for that year.
Code:
For example.
____________ROOT____________
/ \
___2003_______ _____2004_____________
/ | | | \ / | | | \
Jan Feb Apr Jun Jul Jan Mar Jun Jul Sep
/ | | \
2 4 12 31
etc etc.
Not every day will have a directory, or every month etc
What I want is an algorithm that will take one unsigned integer that will go back a certain number of "updates" and pull out the HTML file (or give me a path to it), for example if the last 4 updates were on the 26th of April,and the 1st,2nd and 4th of May 2004 and I gave it the number 2, it would give me the third least recent one, ie the one for the 1st of May.
This seems like an easy problem but im having problems finding a simple fast elegant solution to it. and any help would by appreicated. Thanks