Clean up the files that have been created on the local worker file system.
Without this expect both performance issues and eventual failure
433857
@Override
  public void close() throws IOException {

    if (Files.exists(outFile)) {
      Files.delete(outFile);
    }

    if (Files.exists(errFile)) {
      Files.delete(errFile);
    }

    if (Files.exists(resultFile)) {
      Files.delete(resultFile);
    }
  }
1063970
private void cleanupErrorFile(Watcher watcher) {
        File file = getErrorFileForWatcher(watcher);
        FileUtils.deleteQuietly(file);
    }
832789
protected void cleanup() {
    // Clean-up global list of temporary vectors
    Futures fs = new Futures();
    cleanupTrash(_gVecTrash, fs);
    cleanupTrash(_lVecTrash, fs);
    fs.blockForPending();
  }
1238130
def _clean_workers(self):
        """"""
        while self._bag_collector:
            self._bag_collector.popleft()
        self._timer_worker_delete.stop()
1336273
void cleanupClusterConfigFiles() throws IOException {
    Zxid latestZxid = getLatestZxid();
    List<File> files = getFilesWithPrefix(this.rootDir, "cluster_config");
    if (files.isEmpty()) {
      LOG.error("There's no cluster_config files in log directory.");
      throw new RuntimeException("There's no cluster_config files!");
    }
    Iterator<File> iter = files.iterator();
    while (iter.hasNext()) {
      File file = iter.next();
      String fileName = file.getName();
      String strZxid = fileName.substring(fileName.indexOf('.') + 1);
      Zxid zxid = Zxid.fromSimpleString(strZxid);
      if (zxid.compareTo(latestZxid) > 0) {
        // Deletes the config file if its zxid is larger than the latest zxid on
        // disk.
        file.delete();
        iter.remove();
      }
    }
    if (files.isEmpty()) {
      LOG.error("There's no cluster_config files after cleaning up.");
      throw new RuntimeException("There's no cluster_config files!");
    }
    // Persists changes.
    fsyncDirectory();
  }
1160167
def clean_built(outdir):
    """"""
    print("Removing the built files!")

    # Remove the  build folder
    build_dir = os.path.join(cwd, outdir)
    if os.path.exists(build_dir):
        shutil.rmtree(build_dir)
885607
def cleanup(dest, tardir, counterfile):
    """"""
    thefiles = Queue()
    # dest directory files
    queue_files(dest, thefiles)
    # tar directory files
    queue_files(tardir, thefiles)
    while not thefiles.empty():
        d_file = thefiles.get()
        info("Deleting file: %s" % d_file)
        os.unlink(d_file)
    if os.path.exists(counterfile):
        info("Deleting the counter file %s" % counterfile)
        os.unlink(counterfile)
1090803
def cleanup(self):
        """"""
        shutil.rmtree(self.name, onerror=lambda *a: os.chmod(a[1], __import__('stat').S_IWRITE) or os.unlink(a[1]))
        if os.path.exists(self.name):
            raise IOError(17, "File exists: '{}'".format(self.name))
429817
def clean(ctx, dry_run=False):
    """"""
    # -- VARIATION-POINT 1: Allow user to override in configuration-file
    directories = ctx.clean.directories
    files = ctx.clean.files

    # -- VARIATION-POINT 2: Allow user to add more files/dirs to be removed.
    extra_directories = ctx.clean.extra_directories or []
    extra_files = ctx.clean.extra_files or []
    if extra_directories:
        directories.extend(extra_directories)
    if extra_files:
        files.extend(extra_files)

    # -- PERFORM CLEANUP:
    execute_cleanup_tasks(ctx, cleanup_tasks, dry_run=dry_run)
    cleanup_dirs(directories, dry_run=dry_run)
    cleanup_files(files, dry_run=dry_run)
65610
def cleanup(self):
        
        if self.sock is not None:
            self.sock.close()
        if self.outfile is not None:
            self.outfile.close()
        if self.bar is not None:
            self.update_progress(complete=True)
443861
protected function cleanup()
    {
        $this->filesystem->remove($this->tmpFolder);
        $this->root = null;
        $this->urlsets = array();
    }
15167
protected function cleanup()
    {
        if (is_dir($this->dir)) {
            // Recursively delete all files and folders.
            $files = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator($this->dir, \RecursiveDirectoryIterator::SKIP_DOTS),
                \RecursiveIteratorIterator::CHILD_FIRST
            );

            foreach ($files as $fileinfo) {
                if ($fileinfo->isDir()) {
                    rmdir($fileinfo->getRealPath());
                } else {
                    unlink($fileinfo->getRealPath());
                }
            }
            rmdir($this->dir);
            unset($this->git);
        }
    }
147963
private void cleanLogFilesIfNecessary() {
    File logDir = new File(folderPath);
    File[] files = logDir.listFiles();
    if (files == null) {
      return;
    }
    for (File file : files) {
      if (cleanStrategy.shouldClean(file)) {
          file.delete();
      }
    }
  }
1288940
def cleanDir(self):
        '''  '''
        if os.path.isdir(self.outdir):
            baddies = ['tout.json','nout.json','hout.json']
            for file in baddies:
                filepath = os.path.join(self.outdir,file)
                if os.path.isfile(filepath):
                    os.remove(filepath)
294980
function clean() {
    swig.log.info('', 'Cleaning the /public directory...');

    let paths = [
      './public/**/{target}/**/*',
      '!./public/**/{target}/**/config',
      '!./public/**/{target}/**/config/**/*',
      '!./public/**/{target}/**/src',
      '!./public/**/{target}/**/src/**/*',
      '!./public/css/{target}/main.less',
      '!./public/spec/{target}/**/*'
    ];

    paths = _.map(paths, p => p.replace('{target}', swig.pkg.name));
    const files = glob.sync(paths);

    swig.log.verbose(`[clean] ${files.length} files found at: `);
    swig.log.verbose(paths);

    _.each(files, (file) => {
      swig.log.verbose(`[clean] removing: ${file}`);
      rimraf.sync(path.normalize(file));
    });
  }
1204059
public function cleanUp()
    {
        $this->filesystem->remove($this->compressedArchivePath);
        $this->filesystem->remove($this->outputPath);
    }
929355
public function cleanup()
    {
        if ($this->isEnabled() && $this->hasPattern() && realpath($this->installDir)) {
            $paths = iterator_to_array($this->finder->in($this->installDir));

            /** @var \SplFileInfo $path */
            foreach ($paths as $path) {
                $this->filesystem->remove($path);
            }
        }
    }