Save all files containing only unreadable data (no data upgrades), which discards this data.
Remove those items from the data map.
327966
@RequirePOST
    public HttpResponse doDiscard(StaplerRequest req, StaplerResponse rsp) {
        saveAndRemoveEntries( new Predicate<Map.Entry<SaveableReference,VersionRange>>() {
            @Override
            public boolean apply(Map.Entry<SaveableReference, VersionRange> entry) {
                return entry.getValue().max == null;
            }
        });

        return HttpResponses.forwardToPreviousPage();
    }
661323
def save_attributes(self):
        '''
        
        '''
        if not self.saveable():
            raise AttributeError("Cannot save attribute file without a valid file")
        if self._read_only:
            raise AttributeError("Cannot save read-only data")
        if not self._db_closed:
            self._fd.clear()
            for attr_name in self._saved_attrs:
                self._fd[attr_name] = getattr(self._target, attr_name)
655812
def flush(self):
        """"""
        # We DO write meta files even on read-only targets, but not in dry-run mode
        # if self.target.readonly:
        #     write("DirMetadata.flush(%s): read-only; nothing to do" % self.target)
        #     return
        assert self.path == self.target.cur_dir
        if self.target.dry_run:
            # write("DirMetadata.flush(%s): dry-run; nothing to do" % self.target)
            pass

        elif self.was_read and len(self.list) == 0 and len(self.peer_sync) == 0:
            write("Remove empty meta data file: {}".format(self.target))
            self.target.remove_file(self.filename)

        elif not self.modified_list and not self.modified_sync:
            # write("DirMetadata.flush(%s): unmodified; nothing to do" % self.target)
            pass

        else:
            self.dir["_disclaimer"] = "Generated by https://github.com/mar10/pyftpsync"
            self.dir["_time_str"] = pretty_stamp(time.time())
            self.dir["_file_version"] = self.VERSION
            self.dir["_version"] = __version__
            self.dir["_time"] = time.mktime(time.gmtime())

            # We always save utf-8 encoded.
            # `ensure_ascii` would escape all bytes >127 as `\x12` or `\u1234`,
            # which makes it hard to read, so we set it to false.
            # `sort_keys` converts binary keys to unicode using utf-8, so we
            # must make sure that we don't pass cp1225 or other encoded data.
            data = self.dir
            opts = {"indent": 4, "sort_keys": True, "ensure_ascii": False}

            if compat.PY2:
                # The `encoding` arg defaults to utf-8 on Py2 and was removed in Py3
                # opts["encoding"] = "utf-8"
                # Python 2 has problems with mixed keys (str/unicode)
                data = decode_dict_keys(data, "utf-8")

            if not self.PRETTY:
                opts["indent"] = None
                opts["separators"] = (",", ":")

            s = json.dumps(data, **opts)

            self.target.write_text(self.filename, s)
            if self.target.synchronizer:
                self.target.synchronizer._inc_stat("meta_bytes_written", len(s))

        self.modified_list = False
        self.modified_sync = False
968410
@Transactional(readOnly = true)
  public void cleanupData()
  {

    List<String> allFilesInDatabaseList = getJdbcTemplate().queryForList(
      "SELECT filename FROM media_files AS m", String.class);

    File dataDir = getRealDataDir();

    Set<File> allFilesInDatabase = new HashSet<>();
    for (String singleFileName : allFilesInDatabaseList)
    {
      allFilesInDatabase.add(new File(dataDir, singleFileName));
    }

    log.info("Cleaning up the data directory");
    // go through each file of the folder and check if it is not included
    File[] childFiles = dataDir.listFiles();
    if (childFiles != null)
    {
      for (File f : childFiles)
      {
        if (f.isFile() && !allFilesInDatabase.contains(f))
        {
          if (!f.delete())
          {
            log.warn("Could not delete {}", f.getAbsolutePath());
          }
        }
      }
    }
  }
317527
def clear_modified_data(self):
        
        self.__modified_data__ = None

        for value in self.__original_data__:
            try:
                value.clear_modified_data()
            except AttributeError:
                pass
392390
protected function cleanUp()
    {
        $files = glob(__DIR__.DIRECTORY_SEPARATOR.'Mapping'.DIRECTORY_SEPARATOR.'{DataType,Property,Type}'.DIRECTORY_SEPARATOR.'*.php', GLOB_BRACE);
        foreach ($files as $file) {
            unlink($file);
        }
    }
774050
function() {
    // Cleans all cache files
    if (fs.existsSync(this.dir)) {
      var files = fs.readdirSync(this.dir);

      files.forEach(function(file) {
        fs.unlinkSync(path.join(this.dir, file));
      }.bind(this));
    }
  }
394104
def cleanup(self):
        """"""
        t = time.time()
        for noncefile in glob(self.path + '/*.nonce'):
            if os.path.getmtime(noncefile) + self.expiration > t:
                os.unlink(noncefile)
1228300
@Override
    public void destroy() {
        checkDestroyed();
        cleanFiles();
        destroyed = true;

        if (undecodedChunk != null && undecodedChunk.refCnt() > 0) {
            undecodedChunk.release();
            undecodedChunk = null;
        }

        // release all data which was not yet pulled
        for (int i = bodyListHttpDataRank; i < bodyListHttpData.size(); i++) {
            bodyListHttpData.get(i).release();
        }
    }
972298
def _clean_data(data):
    '''
    
    '''
    for key in list(data):
        if key.startswith('__pub'):
            del data[key]
    return data
1210071
function() {
        var items = _utils.getArgArray(arguments);
        if (items.length === 0) {
            throw new Error('no files specified to clean up');
        }
        items.forEach(function(item) {
            try {
                var path = (typeof item === 'string') ? item : item.path;
                _fs.unlinkSync(path);
            } catch (e) {
                // Eat the exception.
            }
        });
    }
1202783
synchronized void clear() throws IOException
   {
      if (out != null)
      {
         out.close();
         out = null;
      }
      try
      {
         if (dir.fileExists(REDO_LOG))
         {
            dir.deleteFile(REDO_LOG);
         }
      }
      catch (IOException e)
      {
         log.error(e.getLocalizedMessage(), e);
         throw e;
      }
      entryCount = 0;
   }
378495
def wipe_results(self):
        
        # Clean results table
        self.db.purge_table('results')

        # Get rid of contents of data dir
        map(shutil.rmtree, glob.glob(os.path.join(self.get_data_dir(), '*.*')))
970479
public void removeAll()
    {
        if (m_aRecords != null)
        {
            for (int iArrayIndex = 0; iArrayIndex < MAX_RECORD_ARRAY_SIZE; iArrayIndex++)
            {   // Free the objects that are no longer used
                this.freeElement(m_aRecords[iArrayIndex]);
                m_aRecords[iArrayIndex] = null;
            }
            m_aRecords = null;
        }
        m_iRecordListStep = 1;
        m_iRecordListEnd = 0;
        m_iRecordListMax = 0; // Current size of the record list (records scanned) (-1 - unknown)
    }
362299
def _files_preserve(self):
        
        result = set()
        files = [] if not self.files_preserve else self.files_preserve
        files.extend([self.stdin, self.stdout, self.stderr])
        for item in files:
            if hasattr(item, 'fileno'):
                result.add(item.fileno())
            if isinstance(item, int):
                result.add(item)
        return result
317905
public void garbageCollect() {
    if (softLimit == 0) {
      reset();
    } else if (data.size() > hardLimit) {
      long boundaryTime = data.get(softLimit).getStartTime();
      data.removeIf((MtasSolrStatus status) -> status.getStartTime() < boundaryTime);
      index.clear();
      data.forEach((MtasSolrStatus status) -> index.put(status.key(), status));
    }
  }
134668
def safe_dump(data, stream=None, **kwds):
    
    return dump_all([data], stream, Dumper=SafeDumper, **kwds)