Source code for core.plugs.trim

# core/plugs/trim.py
#
#

""" trim a core data directory into a new unique clone. """

__copyright__ = "Copyright 2014 B.H.J Thate"

## IMPORTS

from core.utils import cdir
from core import kernel, Object

import logging
import os

# CMNDS

[docs]def trim(event): parsed = event.get_parsed() if not parsed.args: return target = parsed.args[0] objs = kernel.selected(parsed, time=kernel.cfg.time or "", full=True, exclude=target) cdir(target) sig_list = [] for obj in objs: if "signature" not in obj: logging.warn("missing signature") ; continue if obj.signature not in sig_list: obj.write(target + os.sep + obj.get_filetime()) sig_list.append(obj.signature)
kernel.cmnds.register("trim", trim)