Skip to content

Instantly share code, notes, and snippets.

@edsu edsu/bagit.sh
Last active Aug 9, 2018

Embed
What would you like to do?
Remembering the original spirit of BagIt. https://twitter.com/justin_littman/status/778561421428793344
#!/bin/bash
#
# The simplest way to create a valid BagIt bag?
#
# Usage: bagit.sh <dir_to_bag> <bag_dir>
#
# Note: you'll need to have md5deep installed:
# brew install md5deep
# apt-get install md5deep
# etc...
#
source_dir=$1
bag_dir=$2
mkdir -p $bag_dir/data
cp -a $source_dir $bag_dir/data
cd $bag_dir
md5deep -lr data > manifest-md5.txt
echo "BagIt-Version: 0.97" > bagit.txt
echo "Tag-File-Character-Encoding: UTF-8" >> bagit.txt
today=`date +%Y-%m-%d`
echo "Bagging-Date: $today" > bag-info.txt
echo "External-Description: This bag was created by $USER on $today." >> bag-info.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.