in reply to Directory Listing

The expressions glob('*123456*') or else grep {/123456/} readdir DIR will return a list of matching file names.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Directory Listing
by Cody Pendant (Prior) on Jun 26, 2003 at 04:33 UTC
    Just a quick note to say if there's supposed to be only one matching file, might have to be careful about the matching.

    Zaxo's code will find any files which have that number string in it.

    But if there are two or more, like if you have "ab123456.pdf" and "ab1234567.pdf" and "ab9123456.pdf" then you need a more detailed regex.



    “Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
    M-J D