Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
import java.io.File
|
||||
import java.util.Date
|
||||
|
||||
object FileModificationTime extends App {
|
||||
def test(file: File) {
|
||||
val (t, init) = (file.lastModified(),
|
||||
s"The following ${if (file.isDirectory()) "directory" else "file"} called ${file.getPath()}")
|
||||
|
||||
println(init + (if (t == 0) " does not exist." else " was modified at " + new Date(t).toInstant()))
|
||||
println(init +
|
||||
(if (file.setLastModified(System.currentTimeMillis())) " was modified to current time." else " does not exist."))
|
||||
println(init +
|
||||
(if (file.setLastModified(t)) " was reset to previous time." else " does not exist."))
|
||||
}
|
||||
|
||||
// main
|
||||
List(new File("output.txt"), new File("docs")).foreach(test)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue