| | |
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 |
.htaccess access alexa apache api array beginner binary broken cakephp checkbox class cms code convert cron curl database date directory display dropdown dynamic echo email encode error fairness file files folder form forms function functions google hack href htaccess html htmlspecialchars image include indentedsubcategory insert ip javascript joomla limit link login mail mail() menu methods mlm multiple multipletables mysql network newsletters object oop passwords paypal pdf php problem provider query radio random recursion redirect remote script search secure securephp server sessions simple sms source space sql syntax system table tutorial update upload url user validator variable video voteup web youtube






