s0_mvhdf.sh 798 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. proj_dir=~/dss/msense/stress_and_distractibility
  3. # get subdirectories from folder proj_dir/rawdata/asd/
  4. sub_dirs=($(ls -d $proj_dir/rawdata/td/sub-*))
  5. # loop through subdirectories
  6. for sub_dir in ${sub_dirs[@]}; do
  7. # get subject id from subdirectory
  8. sub_id=$(basename $sub_dir)
  9. # get the final three letters of the subject id
  10. sub_id=${sub_id: -3}
  11. # create output directory
  12. new_dir=${proj_dir}/sub-TD${sub_id}
  13. # if the output directory does not exist, create it
  14. if [ ! -d $new_dir ]; then
  15. mkdir -p $new_dir
  16. fi
  17. beh_dir=${new_dir}/beh
  18. if [ ! -d $beh_dir ]; then
  19. mkdir -p $beh_dir
  20. fi
  21. # move the hdf files to the output directory
  22. mv $sub_dir/*.hdf5 $beh_dir
  23. #echo $sub_dir
  24. #echo $beh_dir
  25. # copy csv files to the output directory
  26. cp $sub_dir/*csv $beh_dir
  27. done