diff --git a/source/net/sourceforge/filebot/cli/FolderWatchService.java b/source/net/sourceforge/filebot/cli/FolderWatchService.java index 3361ae22..c8dd02f6 100644 --- a/source/net/sourceforge/filebot/cli/FolderWatchService.java +++ b/source/net/sourceforge/filebot/cli/FolderWatchService.java @@ -80,7 +80,11 @@ public abstract class FolderWatchService implements Closeable { final SortedSet files = new TreeSet(); synchronized (commitSet) { - files.addAll(commitSet); + for (File it : commitSet) { + if (it.isFile()) { + files.add(it); + } + } commitSet.clear(); } @@ -154,6 +158,7 @@ public abstract class FolderWatchService implements Closeable { // start watching newly created folder if (watchTree) { try { + commitSet.addAll(listFiles(singleton(file), Integer.MAX_VALUE, false)); watchFolder(file); } catch (IOException e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.getMessage(), e);