-
Notifications
You must be signed in to change notification settings - Fork 0
/
DivTouch.java
33 lines (29 loc) · 883 Bytes
/
DivTouch.java
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
package splitFile;
import java.io.File;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class DivTouch {
// TODO
public static void main(String[] args) {
Libdiv livdiv = new Libdiv();
Pattern p = Pattern.compile("\\.div$|\\.div/$");
RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
String vmName = bean.getName();
long pid = Long.valueOf(vmName.split("@")[0]);
for(int i = 0; i < args.length; i++){
Matcher m = p.matcher(args[i]);
if(m.find() && ! (new File(args[i]).exists())){
livdiv.divCreate(new File(args[i]));
}else if(m.find()){
String tmp = args[i] + pid;
File file = new File(tmp);
livdiv.divChangeMtime(new File(args[i]), new File(tmp));
if(file.isFile()){
file.delete();
}
}
}
}
}