addressing limitations with xargs, find in terms of output

master
Steve L. Nyemba 8 years ago
parent 854df8a99d
commit fb4487bfdc

@ -240,7 +240,7 @@ class FileWatch(Analysis):
else : else :
# #
# Size provided in bytes we are converting into MB # Size provided in bytes we are converting into MB
size = float(x[0]) / 1000000 size = float(x[0].replace('B','')) / 1000000
month = months.index(x[1]) + 1 month = months.index(x[1]) + 1
day = int(x[2]) day = int(x[2])
age = -1 age = -1
@ -251,6 +251,7 @@ class FileWatch(Analysis):
year = int(x[4]) year = int(x[4])
else: else:
year = datetime.datetime.today().year year = datetime.datetime.today().year
print [year,month,day,x[4]]
file_date = datetime.datetime(year,month,day,int(hour),int(minute)) file_date = datetime.datetime(year,month,day,int(hour),int(minute))
size = round(size,2) size = round(size,2)
#file_date = datetime.datetime(year,month,day,hour,minute) #file_date = datetime.datetime(year,month,day,hour,minute)
@ -259,7 +260,7 @@ class FileWatch(Analysis):
return None return None
def evaluate(self,path): def evaluate(self,path):
cmd = "find :path|xargs ls -lh |awk '{print $5,$6,$7,$8,$9}'".replace(":path",path) cmd = "find :path -print0|xargs -0 ls -ls |awk '{print $6,$7,$8,$9,$10}'".replace(":path",path)
print cmd print cmd
handler = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE) handler = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE)
ostream = handler.communicate()[0].split('\n') ostream = handler.communicate()[0].split('\n')

Loading…
Cancel
Save