remove directories that are given from the list of volumes to use.
This function also makes sure to remove all the blocks that belong to
these volumes.
16145
public void removeVolumes(Configuration conf, List<File> directories) 
      throws Exception {
    if (directories == null || directories.isEmpty()) {
      DataNode.LOG.warn("There were no directories to remove. Exiting ");
      return;
    }
    List<FSVolume> volArray = null;
    lock.readLock().lock();
    try {
      volArray = volumes.removeBVolumes(directories);
    } finally {
      lock.readLock().unlock();
    }
    // remove related blocks
    long mlsec = System.currentTimeMillis();
    lock.writeLock().lock();
    try {
      volumeMap.removeUnhealthyVolumes(volArray);
    } finally {
      lock.writeLock().unlock();
    }
    mlsec = System.currentTimeMillis() - mlsec;
    DataNode.LOG.warn(">>>>>>>>>Removing these blocks took " + mlsec + 
             " millisecs in refresh<<<<<<<<<<<<<<< ");
    StringBuilder sb = new StringBuilder();
    for(FSVolume fv : volArray) {
      sb.append(fv.toString() + ";");
    }
    throw new DiskErrorException("These volumes were removed: " + sb);
  }
444343
def _clean(self):
        
        if CleanupPolicy.EVERYTHING in self.cleanup:
                self.cleanup_containers()
                self.cleanup_volumes()
                self.cleanup_images()
                self._clean_tmp_dirs()
        else:
            if CleanupPolicy.CONTAINERS in self.cleanup:
                self.cleanup_containers()
            if CleanupPolicy.VOLUMES in self.cleanup:
                self.cleanup_volumes()
            if CleanupPolicy.IMAGES in self.cleanup:
                self.cleanup_images()
            if CleanupPolicy.TMP_DIRS in self.cleanup:
                self._clean_tmp_dirs()
997846
def remove_volume(self, volume_name):
        
        logger.info("removing volume '%s'", volume_name)
        try:
            self.d.remove_volume(volume_name)
        except APIError as ex:
            if ex.response.status_code == requests.codes.CONFLICT:
                logger.debug("ignoring a conflict when removing volume %s", volume_name)
            else:
                raise ex
1310493
public function remove_files() {
        $fs = get_file_storage();
        $files = $fs->get_external_files($this->id);
        foreach ($files as $storedfile) {
            $storedfile->delete();
        }
    }
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)
871538
def clean_out_dir(directory):
    
    if not isinstance(directory, path):
        directory = path(directory)
    for file_path in directory.files():
        file_path.remove()
    for dir_path in directory.dirs():
        dir_path.rmtree()
615666
def remove_blank_dirs(self):
        """"""
        if self.is_blank():
            try:
                os.rmdir(self.path)
            except OSError as e:
                print(e)
        else:
            remove_empty_dir(self.path)
1105037
public static function removeDirectories($directories = null)
    {
        if (is_null($directories))
        {
            static::$directories = [];
        }
        else
        {
            $directories = (array) $directories;

            static::$directories = array_filter(static::$directories, function($directory) use ($directories)
            {
                return ( ! in_array($directory, $directories));
            });
        }
    }
755661
def _clear_dir(dirName):
    
    # If we got here, clear dir  
    for fname in os.listdir(dirName):
        try:
            os.remove( os.path.join(dirName, fname) )
        except Exception:
            pass
    try:
        os.rmdir(dirName)
    except Exception:
        pass
1095372
def _prune(self):
        
        done = False
        while not done:
            done = True
            for node in [node for node in self.nodes.values() if node.intermediate]:
                if not [dep for dep in self.nodes.values() if dep.previous == node.volume]:
                    # logger.debug("Removing unnecessary node %s", node)
                    del self.nodes[node.volume]
                    done = False
197483
def prune(self, dir):
        """"""
        match = translate_pattern(os.path.join(dir, '**'))
        return self._remove_files(match.match)
1205086
public function deleteAll()
    {
        foreach (scandir($this->directory) as $file) {
            if (!in_array($file, ['.', '..', 'keep'])) {
                unlink($this->directory . '/' . $file);
            }
        }
    }
366691
def clean_tmp_rootdir(self):
        
        for tmp_rootdir in list(self._dir_clean_list):
            rm_file_or_dir(tmp_rootdir)
            self._dir_clean_list.remove(tmp_rootdir)
92199
protected function removeFiles()
    {
        $generator = $this->getFilenameOption();
        $pattern = $this->cacheDir . DIRECTORY_SEPARATOR . $generator('*');

        $objects = new GlobIterator($pattern);

        foreach ($objects as $object) {
            unlink($object);
        }
    }
849225
public function clear()
    {
        if ($this->files->exists($this->destination)) {
            $this->files->remove($this->destination);
        }

        $this->files->mkdir($this->destination);
    }
272077
def _remove_files(self, directory, pattern):
        '''
        
        '''
        for root, dirnames, file_names in os.walk(directory):
            for file_name in fnmatch.filter(file_names, pattern):
                os.remove(os.path.join(root, file_name))
869282
private function removeFiles()
    {
        foreach ($this->files as $filename) {
            if (file_exists($filename)) {
                @unlink($filename);
            }
        }
        $this->files = array();
    }