Last active
February 14, 2023 07:59
-
-
Save alexlicohen/822c05fd3d6e579ff2edd563ef52829b to your computer and use it in GitHub Desktop.
[Adding Datalad to BIDS dir] Shell commands to add Datalad subdatasets #cohenlab #shell #datalad #BIDS
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
#!/bin/bash | |
# in study dir: | |
# Create superdataset | |
datalad create -c text2git --force | |
for i in `ls -d sub-*`; do | |
if [ ! -d "${i}/.git" ]; then | |
# Create and register the subdataset | |
datalad create -c text2git --force -d . $i | |
fi | |
pushd $i | |
if [[ `git log --oneline | grep "Instruct annex to add text files to Git"` ]]; then | |
echo "procedure cfg_text2git already run" | |
else | |
datalad run-procedure cfg_text2git | |
fi | |
if [ ! -z "$(git status --porcelain)" ]; then | |
# Uncommitted changes | |
datalad save | |
else | |
# Working directory clean | |
echo "$i is all set" | |
fi | |
popd | |
done | |
datalad save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment