Last active
January 8, 2019 16:02
-
-
Save edsu/013c0d0d10e989f1af72e9790d0cf5cf to your computer and use it in GitHub Desktop.
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 python3 | |
""" | |
usage: batch_validate.py <bags directory> | |
""" | |
import os | |
import sys | |
import bagit | |
bags_dir = sys.argv[1] | |
for bag_dir in os.listdir(bags_dir): | |
try: | |
bag_path = os.path.join(bags_dir, bag_dir) | |
bag = bagit.Bag(bag_path) | |
bag.validate() | |
print("{} is valid".format(bag_dir)) | |
except bagit.BagError as e: | |
print("{} is invalid: {}".format(bag_dir, e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment