How to find files that match a wildcard string in Java? -


It should be really simple if I have such a string:

 . ./test//sample. Txt  

Then what is a generally accepted method list of files that match this method? (Like it matches ../ test1 / sample22b.txt and ../ test4 / sample-spiffy.txt , but ../ test3 / Sample2 should not match Blah or ../ test44 / sample2.txt )

I have taken a look and it looks like the right animal, But I'm not sure how to use it to find the files in the relative directory path.

I think I can see the source for the ant because it uses wildcard syntax, but I should have some very clear.

( Edit : The above example was just a sample case, I'm looking for a way to parse the normal path of wildcard on runtime, I have found out that How it is based on the suggestion of the Emmires, but it is annoying. To mention that JAW seems to "save" time and trouble with a logic to automatically pars the main wildcard with a warming. .. I am just happy that I did 'non-file logic exists in this mix.)

< P> Consider DirectoryScanne from Apache et R:

  directory scanner scanner = new directory escanner (); Scanner.setIncludes (new string [] {"** / *. Java"}); Scanner.setBasedir ("C: / temporary"); Scanner.setCaseSensitive (wrong); Scanner.scan (); String [] files = scanner.gate contains file ();  

You will need to refer to ant.jar (1.3 MB for ~ 1.7.1).


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -