-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSuccessOTA.java
More file actions
47 lines (37 loc) · 1.28 KB
/
Copy pathSuccessOTA.java
File metadata and controls
47 lines (37 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package readtextfile;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Scanner;
public class SuccessOTA {
final static Charset ENCODING = StandardCharsets.UTF_8;
int[] SuccessIMEI = new int[500];
public static void main(String[] args) throws IOException {
SuccessOTA text = new SuccessOTA();
File file = new File("C:/../Logdata/");
File[] files = file.listFiles();
for(File f: files){
//System.out.println(f.getName()+" >>> " + f.length());
text.readFile(f.getPath().toString());
}
/*Print the count*/
System.out.println("Total Number of Files: " + files.length);
}
public void readFile(String aFileName)throws IOException{
Path path = Paths.get(aFileName);
try(Scanner sc = new Scanner(path,ENCODING.name())){
while(sc.hasNextLine()){
String str = sc.nextLine();
if(str.contains("Successful")){
System.out.println(aFileName.substring(aFileName.indexOf("txt")+3, aFileName.length()-4));
/*str.substring(str.startsWith("txt"), str.length())*/
//System.out.println("Success" + aFileName.toString());
break;
}
}
}
}
}