Add `filepaths` to blacklisted filepaths.
        If `remove_from_stored` is `True`, any `filepaths` in
        internal state will be automatically removed.
978017
def add_blacklisted_filepaths(self, filepaths, remove_from_stored=True):
        
        self.file_manager.add_blacklisted_filepaths(filepaths,
                                                    remove_from_stored)
805439
def _add_file(self, path, **params):
        
        log = self._getparam('log', self._discard, **params)
        fd = None
        try:
            fd = os.open(path, os.O_RDONLY)
        except Exception as e:
            if not self.paths[path]:
                log.error("Open failed on watched path %r -- %s", path, e, exc_info=log.isEnabledFor(logging.DEBUG))
                raise e
            elif path in self.paths_pending:
                log.debug("path %r is still pending -- %s", path, e)
            else:
                self.paths_pending[path] = True
                log.debug("Added %r to pending list after open failure -- %s", path, e)
            return False
        if self._mode == WF_KQUEUE:
            log.debug("path %s opened as fd %d", path, fd)
            try:
                ev = select.kevent(fd,
                    filter=select.KQ_FILTER_VNODE,
                    flags=select.KQ_EV_ADD | select.KQ_EV_CLEAR,
                    fflags=select.KQ_NOTE_WRITE | select.KQ_NOTE_ATTRIB | select.KQ_NOTE_LINK |
                                select.KQ_NOTE_DELETE | select.KQ_NOTE_RENAME)
                self._kq.control([ev], 0, 0)
            except Exception as e:
                log.error("kevent failed on watched path %r -- %s", path, e)
                try: os.close(fd)
                except: pass
                raise e

        elif self._mode == WF_INOTIFYX:
            #  inotify doesn't need the target paths open, so now it is known to be
            #  accessible, close the actual fd and use the watch-descriptor as the fd.
            #
            #  However, due to an apparent simfs bug where inotify does not fire either
            #  IN_DELETE_SELF or IN_MOVE_SELF, we need to record the inode so that we
            #  can detect deletes and renames internally.  simfs is used in containers.
            #
            try:
                s = os.fstat(fd)
                self._inx_inode[path] = s.st_ino
            except Exception as e:
                log.error("fstat(%d) failed on open path %r -- %s", fd, path, e)
                try: os.close(fd)
                except: pass
                raise e
            try: os.close(fd)
            except: pass
            try:
                fd = pynotifyx.add_watch(self._inx_fd, path, self._inx_mask)
                log.debug("path %s watched with wd %d", path, fd)
            except Exception as e:
                log.error("inotify failed on watched path %r -- %s", path, e)
                raise e

        elif self._mode == WF_POLLING:
            log.debug("path %s opened as fd %d", path, fd)
            fstate = self._poll_get_stat(fd, path)
            if fstate:
                self._poll_stat[fd] = fstate

        self.paths_open[path] = fd
        self.fds_open[fd] = path
        return True
761206
def add(self, abspath_or_winfile, enable_verbose=True):
        
        if isinstance(abspath_or_winfile, str): # abspath
            if abspath_or_winfile in self.files:
                if enable_verbose:
                    print("'%s' already in this collections" % 
                          abspath_or_winfile)
            else:
                self.files.setdefault(abspath_or_winfile, WinFile(abspath_or_winfile))
        elif isinstance(abspath_or_winfile, WinFile): # WinFile
            if abspath_or_winfile.abspath in self.files:
                if enable_verbose:
                    print("'%s' already in this collections" % 
                          abspath_or_winfile)
            else:
                self.files.setdefault(abspath_or_winfile.abspath, abspath_or_winfile)
        else:
            raise TypeError
1083626
def remove_stale_symlinks(path)
      Dir.glob("#{path}/*").each { |f| File.unlink(f) if not File.exist?(f) }
    end
1258220
def clean_file_system_paths_from_not_existing_paths(file_system_paths):
    
    paths_to_delete = []
    for path in file_system_paths:
        if not os.path.exists(path):
            paths_to_delete.append(path)
    for path in paths_to_delete:
        file_system_paths.remove(path)
253365
def AddFile(self, filepath):
    
    if filepath not in self._files:
      self._files.add(filepath)
      return True
    return False
1360619
public void fileReused(File f) {
        if (!recentFiles.contains(f)) {
            throw new IllegalStateException("Selected a recent project that doesn't exist?");
        } else {
            recentFiles.remove(f);
            recentFiles.add(f);
        }
    }
1279382
def _handle_blacklist(blacklist, dirnames, filenames):
    
    for norecurs in blacklist:
        if norecurs in dirnames:
            dirnames.remove(norecurs)
        elif norecurs in filenames:
            filenames.remove(norecurs)
694567
def safe_remove(path):
    
    if not os.path.exists(path):
        return

    try:
        if os.path.isdir(path) and not os.path.islink(path):
            shutil.rmtree(path)
        else:
            os.remove(path)
    except OSError:
        if os.path.exists(path):
            raise
265082
def remove_unused_directories(src_folder, categories):
  
  files = os.listdir(src_folder)
  os.mkdir("unused")
  for name in files:
    full_path = os.path.join(src_folder, name)
    if os.path.isdir(full_path):
      if not( name in categories or name == "_background_noise_"):
        newPath = os.path.join("unused", name)
        print("moving: ", full_path, "-->", newPath)
        shutil.move(full_path, newPath)
948269
def run_on_removals(paths)
      return unless options[:delete]
      validate_at_least_one_target('delete')
      with_all_target_paths(paths) do |_, to_path|
        validate_to_file(to_path)
        UI.info("deleting #{to_path}") if options[:verbose]
        FileUtils.rm(to_path)
      end
    end
750563
def remove_files():
    
    logger.info("Removing local track files that were not downloaded...")
    files = [f for f in os.listdir('.') if os.path.isfile(f)]
    for f in files:
        if f not in fileToKeep:
            os.remove(f)
138974
def remove_folder_content(path, ignore_hidden_file=False):
    
    for file in os.listdir(path):
        if ignore_hidden_file and file.startswith('.'):
            continue

        file_path = os.path.join(path, file)
        if os.path.isdir(file_path):
            shutil.rmtree(file_path)
        else:
            os.remove(file_path)
1155854
def _remove_files(self, predicate):
        
        found = False
        for i in range(len(self.files) - 1, -1, -1):
            if predicate(self.files[i]):
                self.debug_print(" removing " + self.files[i])
                del self.files[i]
                found = True
        return found
233199
def add_forbidden_path(self, forbidden):
        
        if isinstance(forbidden, six.string_types):
            forbidden = [forbidden]

        if self.use_sysroot():
            forbidden = [self.join_sysroot(f) for f in forbidden]

        for forbid in forbidden:
            self._log_info("adding forbidden path '%s'" % forbid)
            for path in glob.glob(forbid):
                self.forbidden_paths.append(path)
810647
public ClassGraph blacklistPaths(final String... paths) {
        for (final String path : paths) {
            final String pathNormalized = WhiteBlackList.normalizePath(path);
            if (pathNormalized.isEmpty()) {
                throw new IllegalArgumentException(
                        "Blacklisting the root package (\"\") will cause nothing to be scanned");
            }
            // Blacklisting always prevents further recursion, no need to blacklist sub-directories / nested paths
            final String packageName = WhiteBlackList.pathToPackageName(pathNormalized);
            scanSpec.packageWhiteBlackList.addToBlacklist(packageName);
            scanSpec.pathWhiteBlackList.addToBlacklist(pathNormalized + "/");
            if (!pathNormalized.contains("*")) {
                // Blacklist sub-directories / nested paths
                scanSpec.packagePrefixWhiteBlackList.addToBlacklist(packageName + ".");
                scanSpec.pathPrefixWhiteBlackList.addToBlacklist(pathNormalized + "/");
            }
        }
        return this;
    }
1026848
public static void deleteDirIfExists(UnderFileSystem ufs, String path) throws IOException {
    if (ufs.isDirectory(path)
        && !ufs.deleteDirectory(path, DeleteOptions.defaults().setRecursive(true))) {
      throw new IOException("Folder " + path + " already exists but can not be deleted.");
    }
  }