Directory Search using FilenameFilter
I have a directory that has over 100,000 files in the following format:
Invoice-100010001-16072007.xls
Invoice-100010001-16072007.pdf
I want to be able to find all files with a certain name (ie Invoice-100010001).
Is it possible to use a FilenameFilter to implement this?
# 3
> I was just concern about the timing/perfomance. In
> the list method, is it a loop through all the files
> in the directory? Wouldn't this be a problem if I
> have over 10000 files?
Probably since Java loads all the files/directories index items and then filters them.
# 5
> is there an alternative to the filter or any
> optimization that can be done?
Not that I am aware of through pure Java. You may be able to do something with JNI or even with Runtime.exec().