Java how to get file without full name -


i need file directory downloaded application in part of app, name of file creating dynamically. mean query_ , digits, fe. query_21212121212, query_22412221. need absolute file path, sth c:/dir/query_*. how that?

if know path files reside, can create directorystream , files in it.

see https://docs.oracle.com/javase/tutorial/essential/io/dirs.html#glob

example (from link above):

path dir = ...; try (directorystream<path> stream =      files.newdirectorystream(dir, "*.{java,class,jar}")) { //<--- change glob                                                              //fit name pattern.     (path entry: stream) {         system.out.println(entry.getfilename());     } } catch (ioexception x) {     // ioexception can never thrown iteration.     // in snippet, can // thrown newdirectorystream.     system.err.println(x); } 

about globs: https://docs.oracle.com/javase/tutorial/essential/io/fileops.html#glob

so in case "query_*". use special extension or no extension @ all? if .txt glob should "query_[0-9]+.txt".


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -