If this were my problem (being a by my guts programmer) I would read the to an array i.e.:
0 = file_0907.pdf
1 = file_1007.pdf
2 = file_1107.pdf
3 = file_1007.pdf
4 = file_1207.pdf
5 = file_0108.pdf
6 = file_0208.pdf
7 = file_0308.pdf
then a second two dimensional array with the first column as the YEARMONTH of the file name and the second as it's array element in the array as:
array(0,0) = '0709' array(0,1) = '0'
array(1,0) = '0710' array(1,1) = '1'
array(2,0) = '0712' array(2,1) = '2'
array(3,0) = '0712' array(3,1) = '3'
etc.
Then sort the array based on column one and take the first or last element - depending on how you sorted it - and read the send column. That would be the array element of the first array having the oldest/latest file name.
Not probably the most elegant code, but I never had time to be elegant, just produce. Perhaps someone will be better spoken on this.