Re: How to Detect File in a Specifc Directory on Window Env?

From: Date: Fri, 19 Jul 2002 09:34:58 +0000
Subject: Re: How to Detect File in a Specifc Directory on Window Env?
References: 1  Groups: php.general php.windows 
Request: Send a blank email to php-general+get-108469@lists.php.net to get a copy of this message
Jack wrote:
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!
I think I would do something like this: <?php //DATEFORMAT YYYYMMDD if($dir=@opendir("/yourdirwithpdf")) { echo "Found following files:" while(($file=readdir($dir))!==false) {
    if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf")) {
      echo '<a href="'.$file.'">'.$file.'<\n>';
    }
} } ?> Regards, Johan

« previous php.general (#108469) next »