Last active
April 2, 2020 00:17
-
-
Save divyanganar/3232174c8cfef4f75c3828d0e6996ba9 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
#!/bin/bash | |
echo "starting to convert files from old to bids format..." | |
i=0 | |
for sub_path in ./old/*; do | |
let "i+=1" | |
printf -v index "%02d" $i | |
sub=${sub_path:6} | |
echo "$sub $index" | |
# creating bids directories and moving files | |
mkdir "./bids/sub-$index" | |
mkdir "./bids/sub-$index/anat" | |
mkdir "./bids/sub-$index/func" | |
mv "./old/${sub}/rest/rest.nii" "./bids/sub-${index}/func/sub-${index}_task-rest_bold.nii" | |
mv "./old/${sub}/t1/t1.nii" "./bids/sub-${index}/anat/sub-${index}_T1w.nii" | |
#a line needs to be added to modify the json file name also. e.g., mv "./old/${sub}/rest/____.json" "./bids/sub-${index}/anat/sub-${index}_task-rest_bold.json" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment