|
|
@ -187,6 +187,7 @@ class Folders(Actor):
|
|
|
|
#self.action = args['action'] #{clear,archive} config['actions']['folders']
|
|
|
|
#self.action = args['action'] #{clear,archive} config['actions']['folders']
|
|
|
|
self.threshold = self.get_size( args['threshold']) #self.config['threshold'])
|
|
|
|
self.threshold = self.get_size( args['threshold']) #self.config['threshold'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def archive(self,item):
|
|
|
|
def archive(self,item):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
This function will archive all files in a given folder
|
|
|
|
This function will archive all files in a given folder
|
|
|
@ -224,7 +225,9 @@ class Folders(Actor):
|
|
|
|
converts size values into MB and returns the value without units
|
|
|
|
converts size values into MB and returns the value without units
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
units = {'MB':1000,'GB':1000000,'TB':1000000000} # converting to kb
|
|
|
|
units = {'MB':1000,'GB':1000000,'TB':1000000000} # converting to kb
|
|
|
|
key = set(units) & set(re.split('(\d+)',value.upper()))
|
|
|
|
key = set(units.keys()) & set(re.split('(\d+)',value.replace(' ','').upper()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(key) == 0:
|
|
|
|
if len(key) == 0:
|
|
|
|
return -1
|
|
|
|
return -1
|
|
|
|
key = key.pop()
|
|
|
|
key = key.pop()
|
|
|
@ -242,9 +245,8 @@ class Folders(Actor):
|
|
|
|
|
|
|
|
|
|
|
|
def analyze(self,logs):
|
|
|
|
def analyze(self,logs):
|
|
|
|
r = {'clean':self.clean,'archive':self.archive}
|
|
|
|
r = {'clean':self.clean,'archive':self.archive}
|
|
|
|
|
|
|
|
self.lfolders = [ folder['label'] for folder in logs]
|
|
|
|
for item in logs :
|
|
|
|
for item in logs :
|
|
|
|
if self.can_clean(item) :
|
|
|
|
if self.can_clean(item) :
|
|
|
|
|
|
|
|
self.archive(item)
|
|
|
|
id = self.config['action'].strip()
|
|
|
|
#self.clean(item)
|
|
|
|
pointer = r[id]
|
|
|
|
|
|
|
|
pointer (item)
|
|
|
|
|
|
|
|