Using a wildcard character I want to process files in a directory. If a wildcard character is specified I want to process those files which match the wildcard char else if not specified I'll process all the files. Here's my code 

```
   List<File> fileList;
   File folder = new File("Directory");
   File[] listOfFiles = folder.listFiles();
    if(prop.WILD_CARD!=null) {  
        Pattern wildCardPattern = Pattern.compile(".*"+prop.WILD_CARD+"(.*)?.csv",Pattern.CASE_INSENSITIVE);
        for(File file: listOfFiles) {
            Matcher match = wildCardPattern.matcher(file.getName());
            while(match.find()){
                String fileMatch = match.group();
                if(file.getName().equals(fileMatch))  {
                    fileList.add(file); // doesn't work
                }
            }
        }
    }
    else
        fileList = new LinkedList<File>( Arrays.asList(folder.listFiles()));

```

I'm not able to put the files that match wildcard char in a separate file list. Pls help me to modify my code so that I can put all the files that match wildcard char in a separate file list. Here I concatenate prop.WILD\_CARD in my regex, it can be any string, for instance if wild card is test, my pattern is .*test(.*)?.csv. And I want to store the files matching this wildcard and store it in a file list.