Mark, you'll need to get the directory from your wildcard spec. Something like a substring from 0 to the last position of file separator. Then create a File on that directory and call the list() method with the filter shown above as an argument. All files returned by list() will match your pattern. Cool beans.
BTW: That's all deliberately vague so you can have the thrill of digging through the JavaDoc. Holler if you need more detail.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Mark Mero
Greenhorn
Joined: Oct 14, 2004
Posts: 12
posted
0
I have tried the FilelistFilter method, but i want to be able to create a file object without having to list the dir contents. What would the syntax be for creating a file object using regular expressions?
Thanks
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
posted
0
Think you're out of luck. If you created a file with a wildcard in the name what would its name be?
Mark Mero
Greenhorn
Joined: Oct 14, 2004
Posts: 12
posted
0
Stan, you're right! I've modified my use of the FilenameFilter & it is now working fine.