-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.kt
39 lines (31 loc) · 1.06 KB
/
Main.kt
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
import net.daskelly45.fileeventshandler.core.FileSystemEventHandler
import java.io.File
fun main() {
FileSystemEventHandler.watch("/home/dave45/Bureau") {
useBuiltInMatcher = true
isRecursive = true
registerNewDirectories = true
ignoredFolders = arrayOf("node_modules")
onFileCreated(FileSystemEventHandler.ANY_KIND_OF_FILES) { fileFullPath, _ ->
File("")
println("file \"$fileFullPath\" was just created")
}
onFileModified(FileSystemEventHandler.ANY_KIND_OF_FILES) { fileFullPath, _ ->
println("file \"$fileFullPath\" was just modified")
}
onFileDeleted(FileSystemEventHandler.ANY_KIND_OF_FILES) { fileFullPath, _ ->
println("file \"$fileFullPath\" was just deleted")
}
onInterrupt {
println(it.message)
}
onInaccessibleDirectory {
println("$it just become inaccessible")
}
onOverflow {
println("=== OVERFLOW ===")
}
startWatching()
}
readLine()
}