I'm tring to get file list with specific name.
But it is not easy to use FileterUtils
from apache commons.
My goal is getting all files with pattern *_fact_.*
.
I tried to as below.
Iterator<File> picFiles =
FileUtils
.iterateFiles(
uploadFile.getParentFile(),
FileFilterUtils.nameFileFilter("*_fact_1.*"),
null
);
But no results.
It might cause my wrong usage of FileFilterUtils
.
What doing I wrong?
You need to be using WildcardFileFilter
instead of NameFileFilter
.
Iterator<File> picFiles =
FileUtils
.iterateFiles(
uploadFile.getParentFile(),
new WildcardFileFilter("*_fact_1.*"),
null
);