commonlib/src/main/java/com/streamsets/pipeline/lib/io/LiveDirectoryScanner.java
public LiveFile scan(LiveFile current) throws IOException {
    try {
      return scanInternal(current);
    } catch (NoSuchFileException ex) {
      // this could happen because there has been a file rotation/deletion after the search/filter/sort and before
      // the creation of the nen current. Lets sleep for 50ms and try again, if fails again give up.
      ThreadUtil.sleep(50);
      return scanInternal(current);
    }
  }
public LiveFile scan(LiveFile current) throws IOException {
    try {
      return scanInternal(current);
    } catch (NoSuchFileException ex) {
      // this could happen because there has been a file rotation/deletion after the search/filter/sort and before
      // the creation of the nen current. Lets sleep for 50ms and try again, if fails again give up.
      ThreadUtil.sleep(50);
      return scanInternal(current);
    }
  }
Scans the directory of for the next file.

@param current the last 'rolled' file processed. Use <code>null</code> to look for the first one. The provided
file cannot be the 'live' file.
@return the next 'rolled' file in order, if there are no more 'rolled' files it will return the 'live' file,
if there is not 'live' file it will return <code>null</code>.
@throws IOException thrown if the directory could not be scanned.