Results 1 to 2 of 2
  1. #1
    minotaurus is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default open file with wildcard?

    hi. i have following code:

    Java Code:
    import java.io.*;
    import java.util.Scanner;
    
    public class Readfile {
    
      public static void main(String... aArgs) throws FileNotFoundException {
        ReadWithScanner parser = new ReadWithScanner("/home/foo/*bar.txt");
        parser.processLineByLine();
      }
      ...
    }
    this does not work. if i do "/home/foo/foobar.txt" it works, of course. how do i get the wildcard handled?
    thanks!

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    Use java.io.File#listFiles(FileFilter / FileNameFilter) and iterate over the returned array.

    db

Similar Threads

  1. Pbm in Generic WildCard?
    By makpandian in forum New To Java
    Replies: 1
    Last Post: 02-07-2011, 08:07 PM
  2. How to display WildCard search values
    By peliukasss in forum Lucene
    Replies: 1
    Last Post: 08-25-2010, 02:29 PM
  3. Replies: 2
    Last Post: 06-17-2010, 12:44 PM
  4. Replies: 0
    Last Post: 03-05-2010, 04:21 AM
  5. Different Files Open in File -> Open Workspace
    By mgm2010 in forum JCreator
    Replies: 0
    Last Post: 04-11-2009, 02:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •