| | |
Display all files in directory beginning with A
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2009
Posts: 16
Reputation:
Solved Threads: 0
Hi all,
I've tried searching both here and google for help on this one. I'm not quite sure what to call it basically I have a directory with different files all .txt. I want to display only the ones beginning with letter A. How do I modify my below code to do this?
I know I need to use something like A* but I don't even know what to call it to search for it?
Thanks!
I've tried searching both here and google for help on this one. I'm not quite sure what to call it basically I have a directory with different files all .txt. I want to display only the ones beginning with letter A. How do I modify my below code to do this?
PHP Syntax (Toggle Plain Text)
<?php if ($handle = opendir('poems/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "$file\n <br />"; } } closedir($handle); } ?>
I know I need to use something like A* but I don't even know what to call it to search for it?
Thanks!
0
#2 Oct 22nd, 2009
•
•
•
•
Hi all,
I've tried searching both here and google for help on this one. I'm not quite sure what to call it basically I have a directory with different files all .txt. I want to display only the ones beginning with letter A. How do I modify my below code to do this?
PHP Syntax (Toggle Plain Text)
<?php if ($handle = opendir('poems/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "$file\n <br />"; } } closedir($handle); } ?>
I know I need to use something like A* but I don't even know what to call it to search for it?
Thanks!
php Syntax (Toggle Plain Text)
<?php if ($handle = opendir('poems/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file[0] == 'A') { echo "$file\n <br />"; } } closedir($handle); }
Last edited by ShawnCplus; Oct 22nd, 2009 at 11:24 am.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
0
#4 Oct 22nd, 2009
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
![]() |
Similar Threads
- Listing files in a directory (C++)
- can't open all of the files in a directory - only some... (C++)
- Help with shell script which looks for a set off files within a directory (Shell Scripting)
- read all files in a directory (C++)
- To open and close in turn all the files in a directory (C++)
- List files from a directory (C)
- code to use all .htm files in a directory (C)
Other Threads in the PHP Forum
- Previous Thread: Hi Please help me on PHP mail Looking for a process which sends email
- Next Thread: PHP Parse Error: parse error in errormsg.php
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube






