Get filename from sdcard which first name is "A" in java.
There are five pictures in my sdcard. Files name: A1.jpg A2.jpg A3.jpg B2.jpg C3.jpg
How can I get filename (A1.jpg A2.jpg A3.jpg) in java?
Get filename from sdcard which first name is "A" in java.
There are five pictures in my sdcard. Files name: A1.jpg A2.jpg A3.jpg B2.jpg C3.jpg
How can I get filename (A1.jpg A2.jpg A3.jpg) in java?
In Java you can use .startsWith
and use .getName()
with File
class (or .getFileName()
with Path
class)
Example
if (file.getName().startsWith("A")) {
// ..
}
You can use a wildcard like this: How to find files that match a wildcard string in Java?
or you read all Files Read all files in a folder and filter them in Memory.