This commit is contained in:
2021-09-27 16:02:11 -04:00
parent 90edf9bd45
commit e18232df84
35 changed files with 3037 additions and 78 deletions

47
reset_trim.py Normal file
View File

@@ -0,0 +1,47 @@
import os
import random
from multiprocessing import Pool
import sys
sys.path.append('/home/thebears/Seafile/Designs/ML')
#rtpath = '/srv/ftp/hummingbird/2021'
rtpath = os.path.abspath(sys.argv[1])
rtpath = os.path.abspath('/srv/ftp/hummingbird/2021/')
didir = list()
for di,dnames, fns in os.walk(rtpath):
numbers = di.split('/')[-3:]
if all([n.isnumeric() for n in numbers]):
didir.append(di)
def list_files(path):
for file in os.listdir(path):
if os.path.isfile(os.path.join(path, file)):
yield file
for cdir in didir:
files = [x for x in list_files(cdir)]
todelete = list()
for y in files:
if 'trimmed' not in y:
ff = os.path.splitext(y)
fcheck = os.path.join(cdir, ''.join([ff[0],'_trimmed',ff[1]]))
if os.path.exists(fcheck):
todelete.append(fcheck)
to_purge = set()
for de in todelete:
if os.path.exists(de.replace('_trimmed','')):
to_purge.add(de)
for y in to_purge:
os.remove(y)