19.9. Getting a List of Filenames Matching a Pattern19.9.2. SolutionIf your pattern is a regular expression, read each file from the directory and test the name with preg_match( ):
19.9.3. DiscussionIf your pattern is a shell glob (e.g., *.*), use the backtick operator with ls (Unix) or dir (Windows) to get the matching filenames. For Unix:
19.9.4. See AlsoRecipe 19.8 details on iterating through each file in a directory; information about shell pattern matching is available at http://www.gnu.org/manual/bash/html_node/bashref_35.html.
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|