Closed dasuttles closed 5 years ago
I don't believe bagit-python has ever calculated that value for you. The Payload-Oxum
field is what bagit uses since it's precise bytes – Bag-Size
is intended for human readers and will usually be an approximate size. If you wanted the equivalent of du -sh | cut -f1
you could either use subprocess.check_output
to run that for you or one of the answers from e.g. https://stackoverflow.com/questions/1392413/calculating-a-directorys-size-using-python/1392549 depending on whether you want to install other Python modules and which versions of Python you need to support.
I see, thanks!
How would you get the bag-size option to work via a python script? It's no longer being calculated and added to bag-info.txt with the following script and nothing I've tried has worked. I'm new to python, so any help would be appreciated...
My CreateBag.py script:
import bagit
#create bag
bag = bagit.make_bag(DIR, {'Source-Organization': 'XXX', 'Organization-Address' : 'XXX', 'Contact-Phone' : 'XXX', 'Contact-Email' : 'XXX', 'Description' : 'XXX', 'External-Identifier' : 'XXX'})
Thanks!