#!/usr/bin/env python2
import os
import subprocess
import sys


def main(target, output):
    args = [
        'bulk_extractor', target, '-o', output,
        '-M', '250', '-q', '-1'
    ]
    try:
        os.makedirs(output)
        subprocess.call(args)
        return 0
    except Exception as e:
        return e

if __name__ == '__main__':
    target = sys.argv[1]
    sipdir = sys.argv[2]
    file_uuid = sys.argv[3]
    output = os.path.join(sipdir, 'logs', 'bulk-' + file_uuid)
    sys.exit(main(target, output))

#!/usr/bin/env python2
import os
import subprocess
import sys


def main(target, output):
    args = [
        'bulk_extractor', target, '-o', output,
        '-M', '250', '-q', '-1'
    ]
    try:
        os.makedirs(output)
        subprocess.call(args)
        # remove empty BulkExtractor logs
        for filename in os.listdir(output):
            filepath = os.path.join(output,filename)
            if os.path.getsize(filepath) == 0:
                os.remove(filepath)
        return 0
    except Exception as e:
        return e

if __name__ == '__main__':
    target = sys.argv[1]
    sipdir = sys.argv[2]
    file_uuid = sys.argv[3]
    output = os.path.join(sipdir, 'logs', 'bulk-' + file_uuid)
    sys.exit(main(target, output))

Remove empty bulk extractor logs
Remove empty bulk extractor logs

Squashed commit of the following:

commit c923667809bb5d828144b09d03bd53554229a9bd
Author: Aaron Elkiss <aelkiss@umich.edu>
Date:   Thu Dec 8 09:34:47 2016 -0500

    fix spacing & variable name

commit df597f69e19c3a3b4210c1131a79550eb147e412
Author: Aaron Daniel Elkiss <aelkiss@umich.edu>
Date:   Mon Oct 31 13:57:32 2016 +0000

    remove empty bulkextractor logs
