I'd use something like:

<?php
$handle=opendir('.');
while (false!==($file = readdir($handle))) {
    if ($file != "." && $file != "..") {
        echo "$file\n";
    }
}
closedir($handle);
?>

to retrieve dir listing. If you make a function from it, which you'll give a
path for argument  you can make the script index an entire dir struct. With
is_file() you can check to see if the dirlist entry is a file.

Then, you can split every filename in different parts with something like

$parts = split(".", $filename);

$parts[0] will then have the "abcdefg" part of the filename
$parts[1] will have the timestamp
$parts[2] will have the extension.

I hope that this answers your question. You may want to insert the file data
in a database for easy searching, and run a script to index the dir every
now and then.

Greetz,
Wouter
----------
Alle door mij verzonden email is careware. Dit houdt in dat het alleen
herlezen en bewaard mag worden als je goed omgaat met al het leven op aarde
en daar buiten. Als je het hier niet mee eens bent dien je mijn mailtje
binnen 24 uur terug te sturen, met opgaaf van reden van onenigheid.

All email sent by me is careware. This means that it can only be reread and
kept if you are good for all the life here on earth and beyond. If you don't
agree to these terms, you should return this email in no more than 24 hours
stating the reason of disagreement.


-----Oorspronkelijk bericht-----
Van: Jack [mailto:[EMAIL PROTECTED]]
Verzonden: vrijdag 19 juli 2002 11:00
Aan: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Onderwerp: [PHP] How to Detect File in a Specifc Directory on Window
Env?


Dear all
I had a folder which contains a lot of pdf file, the name format of the pdf
files are : xxxxx.dateformat.pdf (eg : abcdefg.20020718.pdf).
Now i want to use the php script to detect what files it got in a specific
folder.
i want to make a user input form which will let user to input the date and
then i will look for the pdf report from this specific folder base on the
Date given!

I think one of the quickest way is to ask php to check the filename from
"Right to Left" which is the Date format!

But i don't know which php function will perform this task (Check filename
from Right to Left).

If you have any other suggestion, pls help me!


--
Thx a lot!
Jack
[EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to