remove .* and _* files and directories under root
164318
def clean_dir(root):
    ''''''
    for x in root.walkdirs('.*', errors='ignore'):
        x.rmtree()
    for x in root.walkdirs('_*', errors='ignore'):
        x.rmtree()

    for x in root.walkfiles('.*', errors='ignore'):
        x.remove()
    for x in root.walkfiles('_*', errors='ignore'):
        x.remove()
296301
def cleanup(self):
        """"""
        for file in glob.glob(self.basename + '*'):
            os.unlink(file)
420141
def remove_empty_dirs(path):
    
    for root, dirs, files in os.walk(path):
        for d in dirs:
            dir_path = os.path.join(root, d)
            if not os.listdir(dir_path):
                os.rmdir(dir_path)
316425
private void purgeDirectories(FileSystem fs, Path root) throws IOException {
    DirectoryTraversal traversal =
        DirectoryTraversal.directoryRetriever(Arrays.asList(root), fs,
            directoryTraversalThreads, directoryTraversalShuffle);
    String prefix = root.toUri().getPath();
    
    FileStatus dir;
    while ((dir = traversal.next()) != DirectoryTraversal.FINISH_TOKEN) {
      Path dirPath = dir.getPath();
      if (dirPath.toUri().getPath().endsWith(RaidNode.HAR_SUFFIX)) {
        continue;
      }
      String dirStr = dirPath.toUri().getPath();
      if (!dirStr.startsWith(prefix)) {
        continue;
      }
      entriesProcessed.incrementAndGet();
      String src = dirStr.replaceFirst(prefix, "");
      if (src.length() == 0) continue;
      Path srcPath = new Path(src);
      if (!fs.exists(srcPath)) {
        performDelete(fs, dirPath, true);
      }
    }
  }
252655
def _cleanup(self):
        """"""
        self._expkg = None
        self._extmp = None
        self._flag_e = True
        self._ifile.close()
1276650
def removed_tree(self, dirname):
        """"""
        dirname = osp.abspath(to_text_string(dirname))
        for fname in self.get_filenames():
            if osp.abspath(fname).startswith(dirname):
                self.close_file_from_name(fname)
197483
def prune(self, dir):
        """"""
        match = translate_pattern(os.path.join(dir, '**'))
        return self._remove_files(match.match)
273402
def cleanup_temporary_directories(self):
        """"""
        while self.build_directories:
            shutil.rmtree(self.build_directories.pop())
        for requirement in self.reported_requirements:
            requirement.remove_temporary_source()
        while self.eggs_links:
            symbolic_link = self.eggs_links.pop()
            if os.path.islink(symbolic_link):
                os.unlink(symbolic_link)
151913
def cleanup(config=None, path=None):
    """"""
    if config is None:
        config = parse()
    if path is None:
        path = os.getcwd()
    root = config.get('root', 'path')
    root = os.path.join(path, root)
    if sys.path[0] == root:
        sys.path.remove(root)
34736
def clean():
    
    for dirpath, dirnames, filenames in os.walk('.'):
        for filename in filenames:
            if filename.endswith('.pyc') or filename.endswith('.pyo'):
                filepath = os.path.join(dirpath, filename)
                click.echo(f'Removing {filepath}')
                os.remove(filepath)
1314311
def clean(ctx):
    ''''''
    header(clean.__doc__)
    with ctx.cd(ROOT):
        for pattern in CLEAN_PATTERNS:
            info(pattern)
            ctx.run('rm -rf {0}'.format(' '.join(CLEAN_PATTERNS)))
1057283
def remove_directories(list_of_paths):
    
    found_dirs = set('/')
    for path in list_of_paths:
        dirs = path.strip().split('/')
        for i in range(2,len(dirs)):
            found_dirs.add( '/'.join(dirs[:i]) )

    paths = [ path for path in list_of_paths if
              (path.strip() not in found_dirs) and path.strip()[-1]!='/' ]
    return paths
1090939
def _clean(c):
    
    if isdir(c.sphinx.target):
        rmtree(c.sphinx.target)
66962
def _clean_directory(self, name):
        """"""
        if not os.path.exists(name):
            return
        self.announce(
            "removing directory '{}' and all its contents".format(name)
        )
        if not self.dry_run:
            rmtree(name, True)
901088
def cleanup(sprocket_assets = [:javascripts, :stylesheets])
      # Remove previous dist path
      FileUtils.rm_r build_path if File.exists?(build_path)
      # Clean compass project
      Compass::Exec::SubCommandUI.new(["clean", project_root]).run!
      # Don't initialize Compass assets, the config will take care of it
      sprocket_assets.each do |asset|
        FileUtils.mkdir_p File.join(build_path, asset.to_s)
      end
      if mustaches_config_file_exists?
        mustaches_yaml.each_key do |dir|
          FileUtils.mkdir_p File.join(build_path, dir.to_s)
        end
      end
    end
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)
182005
def cli(ctx):
    """"""
    dir_path = os.path.join(os.path.expanduser('~'), '.keep')
    if os.path.exists(dir_path):
        if click.confirm('[CRITICAL] Remove everything inside ~/.keep ?', abort=True):
            shutil.rmtree(dir_path)
    utils.first_time_use(ctx)