我正在搜索允许选择具有相似名称的多个文件的脚本.我有10个文件:
我想从hello.myapp-1.apk中选择文件到hello.myapp-4.apk.可以只使用这样的一行代码吗?
File su6 = new File("/dir/app/hello.myapp-*.apk");
Run Code Online (Sandbox Code Playgroud)
File dir = new File("/dir/app/");
File [] files = dir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("hello.myapp-") && name.endsWith(".apk");
}
});
for (File file : files) {
//do stuff with file
}
Run Code Online (Sandbox Code Playgroud)