-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathNioFile.js
More file actions
26 lines (15 loc) · 704 Bytes
/
NioFile.js
File metadata and controls
26 lines (15 loc) · 704 Bytes
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
var niofile = function(doc){
var imports = new JavaImporter(java.io.IOException, java.nio.file.Files, java.nio.file.Path, java.nio.file.Paths, java.nio.file.attribute.BasicFileAttributes);
with(imports){
var filepath = "E:\\aetna\\abc.txt";
var file = Paths.get(filepath);
var attr = Files.readAttributes(file, BasicFileAttributes.class);
System.out.println("Creation Time = " + attr.creationTime());
doc.setField("created_t", attr.creationTime());
}
}