I must be missing something, but can someone explain how to use
GlobFilenameFilter ?

I've tried the following simple piece of test code, but it only seems to
match a single file that matches the filter, not all the files that match
the filter. Could someone point out where I'm going wrong (Jakarta-ORO 2.0.4
on Win2K, JDK 1.3.1_01 FWIW).

Thanks,

Greg Thomas

import java.io.File;
import org.apache.oro.io.GlobFilenameFilter;

public class Test {

        public static void main( String[] args ) {

                // Create a filter
                GlobFilenameFilter filter = new GlobFilenameFilter( args[0]
);

                // Find all the files in the folder matching that filter
                File cwd = new File( "." );
                String[] filesFound = cwd.list( filter );

                // And print them out
                System.out.println( "Found " + filesFound.length + "
files");
                for( int i = 0; i < filesFound.length; i ++ ) {
                        System.out.println(" Found file " + filesFound[i] )
;
                }
        }
}

-- 
This post represents the views of the author and does
not necessarily accurately represent the views of BT.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to