If I have a directory called temp
with the following files:
a_file1.jpg
a_file2.jpg
b_file1.jpg
b_file2.jpg
It's possible to get all files like this:
VFS.getManager().resolveFile("temp").getChildren();
But, what I actually want to do is get a_file1.jpg
and a_file2.jpg
. Maybe like:
VFS.getManager().resolveFile("temp/a*").getChildren();
But this throws an exception:
org.apache.commons.vfs.FileSystemException: Could not list the contents of "temp/a*" because it is not a folder.
So, does anyone know how to resolve a set of files based on a regex with VFS?
You could use the findFiles
method, with a FileFilterSelector
.
You'll need to create your own FileFilter
that accept
s the files that match your desired regex.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With