Created
July 24, 2013 19:48
-
-
Save finoradin/6073891 to your computer and use it in GitHub Desktop.
make a bunch of bags at once
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import bagit, argparse, os | |
parser = argparse.ArgumentParser(description="Helper for converting a bunch of dirs into bags.") | |
parser.add_argument('-i', '--input', type=str, required=True, help='The full path to the target dir.') | |
args = parser.parse_args() | |
for directory in os.listdir(args.input): | |
if os.path.isdir(os.path.join(args.input, directory)): | |
thisdir = os.path.normpath(args.input)+'/'+directory | |
print thisdir | |
bagit.make_bag(thisdir, {'Bagged by': 'Ben Fino-Radin'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment