Java - Read many txt files on a folder and process them -
i followed question:
now in case have 720 files named in way: "dom 24 mar 2013_00.50.35_128.txt", every file has different date , time. in testing phase used scanner, specific txt file, operations on it:
scanner s = new scanner(new file("stuff.txt"));
my question is:
how can reuse scanner , read 720 files without having set precise name on scanner?
thanks
assuming have files in 1 place:
file dir = new file("path/to/files/"); (file file : dir.listfiles()) { scanner s = new scanner(file); ... s.close(); } note if have files don't want include, can give listfiles() filefilter argument filter them out.
Comments
Post a Comment