Commit b85937d7 authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team

scripts/missing-all-files.py: list orphan sequence files

parent a8c348ba
import defs
import os
import os.path
def rbx_link(patient_id, config_id):
......@@ -47,9 +48,19 @@ def print_analysis_file(res):
print "** Missing sequences **"
for res in db(db.sequence_file).select():
if not os.path.isfile(defs.DIR_SEQUENCES+res.data_file):
if res.data_file and not os.path.isfile(defs.DIR_SEQUENCES+res.data_file):
print_sequence_file(res)
print "** Orphan sequence files **"
total_size = 0
nb_files = 0
for f in os.listdir(defs.DIR_SEQUENCES):
if os.path.isfile(defs.DIR_SEQUENCES+f) and db(db.sequence_file.data_file == f).count() == 0:
print f
total_size += os.path.getsize(defs.DIR_SEQUENCES+f)
nb_files += 1
print "%d bytes could be removed from %d files" % (total_size, nb_files)
print "** Missing results **"
for res in db(db.results_file).select():
if res.data_file is not None and not os.path.isfile(defs.DIR_RESULTS+res.data_file):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment