Skip to content

Commit

Permalink
bidsmerge2
Browse files Browse the repository at this point in the history
  • Loading branch information
dmd committed Mar 27, 2024
1 parent 32b73f1 commit 9fea10f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bidsmerge2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# Extremly simplistic tool to merge one BIDS directory into another

if [ "$#" -ne 2 ] || ! [ -d "$1" ] || ! [ -d "$2" ]; then
echo "Usage: $0 SOURCEDIR DESTDIR" >&2
exit 1
fi

SOURCE=$1
DEST=$2

for d in ${SOURCE} ${DEST}; do
# is this even nominally a BIDS folder?
if ! [ -e "${d}"/dataset_description.json ]; then
echo "${d} doesn't seem like a BIDS folder to me." >&2
echo "Exiting, out of an abundance of caution." >&2
exit 1
fi
done

rsync -a --remove-source-files "${SOURCE}"/ "${DEST}"/
find "${SOURCE}" -depth -type d -empty -delete

0 comments on commit 9fea10f

Please sign in to comment.