|
Posted by ljb on 12/30/07 02:35
dontspamme@spam.com wrote:
> I have a function below that I (partially) wrote to handle a
> particular situation.
>...
> I find that that scandir() also scans for subdirectories. I _only_
> want to scan for .txt files. Scandir is good for me to use because it
> alphabetizes the files without any additional work.
>
> I would appreciate any help that could be offered as far as ways to
> adjust my $files array so it's only made up of .txt files.
I think you have 2 choices: (1) scandir, then use is_dir() on each name to
discard sub-directories, or (2) if you really want 'names ending in .txt'
(which isn't the same as saying 'only text files'), use glob() and sort the
result yourself.
Navigation:
[Reply to this message]
|