public static void moveAwayDbWithPageCache( File from, File to, PageCache pageCache, FileFilter filter ) { final Stream<FileHandle> fileHandleStream; try { fileHandleStream = pageCache.getCachedFileSystem().streamFilesRecursive( from ); } catch ( IOException e ) { // Directory does not exist, has possibly been moved with file system previous to this call. return; } final Consumer<FileHandle> handleRename = FileHandle.handleRenameBetweenDirectories( from, to ); fileHandleStream.filter( fh -> filter.accept( fh.getFile() ) ).forEach( handleRename ); }