Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 733 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 733 Bytes

treespy

Simplified, zero dependency recursive directory watching API for Java SE 7+

Watch a directory recursively

    TreeSpy spy = SpyFactory.getSpy();
    
    String directory = "/home/wfaithfull"
	
	File home = new File(directory);
	
	spy.watchRecursive(home, (changedFile, eventType) -> {
		System.out.println(String.format("File %s changed", changedFile));
	});

Watch a directory recursively with a glob pattern

	TreeSpy spy = SpyFactory.getSpy();
    
    String directory = "/home/wfaithfull"
	
	File home = new File(directory);
	
	spy.watchRecursive(home, (changedFile, eventType) -> {
		System.out.println(String.format("File %s changed", changedFile));
	}, "glob:*.java", "glob:*.txt");