function keep (basePath, paths, n) {

  for (let i = paths.length; i > n; i--) {
    fs.removeSync(path.resolve(basePath, paths[i - 1]));
  }
}
Given a reverse chronological array of paths
This deletes all files except for n of them

n is the (1 indexed) count of files to keep.