forked from hkajur/FileBasedDesktopSearchEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFDSEE.java
More file actions
67 lines (52 loc) · 1.4 KB
/
FDSEE.java
File metadata and controls
67 lines (52 loc) · 1.4 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import java.io.*;
import java.util.*;
public class FDSEE {
// isSearchable()
public enum SETF {
HTML,
HTM,
TXT,
CC,
CPP,
C,
H,
JAVA
}
public static void isSearchable(String filename){
File file = new File(filename);
boolean isFileExists = fileExists(file);
if(isFileExists){
System.out.println("File exists");
} else {
System.out.println("File doesn't exist");
}
}
public static boolean fileExists(File f){
if(f.exists())
return true;
return false;
}
public static void main(String[] args){
try {
if(args.length == 0 || args.length == 1){
System.err.println("Error: Need at least two argument");
System.exit(1);
}
if(args.length > 2){
System.err.println("Error: Can't have more than two argument");
System.exit(1);
}
String type = args[0];
String filename = args[1];
switch(type){
case "searchable":
isSearchable(filename);
break;
default:
break;
}
} catch (Exception ex){
ex.printStackTrace();
}
}
}