add --clean option to runfolder
[htsworkflow.git] / scripts / runfolder
index 628050e704b342a0c7d70fea4fdedddda6e23110..1380fbf7fde7affcd856d2884af1889811ba3fe2 100644 (file)
@@ -43,6 +43,9 @@ def make_parser():
     parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
                       default=False,
                       help='turn on verbose mode')
+    parser.add_option('--dry-run', action='store_true', default=False,
+                      help="Don't delete anything (in clean mode)")
+
     commands = optparse.OptionGroup(parser, 'Commands')
 
     commands.add_option('-s', '--summary', dest='summary', action='store_true',
@@ -55,6 +58,8 @@ def make_parser():
            default=False,
            help='create run-xml summary, compress the eland result files, and '
                 'copy them and the Summary.htm file into archival directory.')
+    commands.add_option('-c', '--clean', action='store_true', default=False,
+                        help='Clean runfolder, preparing it for long-term storage')
     parser.add_option_group(commands)
 
     parser.add_option('-o', '--output-dir', default=None,
@@ -116,6 +121,10 @@ def main(cmdlist=None):
         if opt.extract_results:
             runfolder.extract_results(runs, opt.output_dir)
             command_run = True
+        if opt.clean:
+            runfolder.clean_runs(runs, opt.dry_run)
+            command_run = True
+
         if command_run == False:
             print "You need to specify a command."+os.linesep
             parser.print_help()