This program is a test to see if I can loop thru a list of possible file names and see if they exist. The reason that I wrote this program is th help me with the entries of my blog. When I build my blog entries, the pages of the blog start with 1 and go to ...? However, when I list the pages at the bottom of the blog, Page 1 is the most recent and, since I produce the pages physically, gets the highest number. Otherwise I get into some kind of reverse numbering system I do not want to deal with. Since, in the initial stages of my blog I do not plan on building a Document Management System (DMS) database online, I need an easy way to find the last page I wrote for the blog (Page 1) which will actually have the largest page name, i.e., blog[n].php. This program is a loop that starts at a large number, say 999, and loops down, checking file names to see if they exist, until it hits the filename with the largest numeric value at the end of the file name. For any other file, say Page 20, I'd just count another 20 down. This is the program I built to learn the process described above.

Initially, I tested out a simple program to find a file named fave1.php. The results are as follows:

Test Print
fave1.php
This file exists.

Next, I needed a looping structure to count down and test whether fhe file exists. Since I already had uploaded my favorites pages created from a table that I had built on my local machine, I used these as a test. These files were fave1.php thru fave9.php and the results of my looping program are as follows:

fave20.php does not exist...    fave19.php does not exist...    fave18.php does not exist...    fave17.php does not exist...    fave16.php does not exist...    fave15.php does not exist...    fave14.php does not exist...    fave13.php does not exist...    fave12.php does not exist...    fave11.php does not exist...    fave10.php does not exist...    fave9.php exists...    fave8.php exists...    fave7.php exists...    fave6.php exists...    fave5.php exists...    fave4.php exists...    fave3.php exists...    fave2.php exists...    fave1.php exists...