[PHP] Re: How to Detect File in a Specifc Directory on Window Env?
Johan Holst Nielsen wrote: >> > //DATEFORMAT MMDD >> if($dir=@opendir("/yourdirwithpdf")) { >> echo "Found following files:" >> while(($file=readdir($dir))!==false) { >> if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf")) { >> echo ''.$file.'<\n>'; >> } >> } >> } >> ?> > > > UPS > > if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf", $file)) > > The ereg line should look like this :) > Wow, I also forgot to close the dir handle! Well I will let you do that :) Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to Detect File in a Specifc Directory on Window Env?
> //DATEFORMAT MMDD > if($dir=@opendir("/yourdirwithpdf")) { > echo "Found following files:" > while(($file=readdir($dir))!==false) { > if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf")) { > echo ''.$file.'<\n>'; > } > } > } > ?> UPS if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf", $file)) The ereg line should look like this :) Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to Detect File in a Specifc Directory on Window Env?
Jack wrote: > Dear all > I had a folder which contains a lot of pdf file, the name format of the pdf > files are : x.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: '.$file.'<\n>'; } } } ?> Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php