-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetch_fMRIprep_reports.sh
More file actions
executable file
·32 lines (25 loc) · 1.09 KB
/
fetch_fMRIprep_reports.sh
File metadata and controls
executable file
·32 lines (25 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Make sure that graham is mounted at ~/Graham (using sshfs)
# Adjust the path to fMRIprep output
fMRIprep_path="/home/ali/Graham/EpLink/eplink-p3-fMRIprep-freesurfer"
# Adjust the destination to which you wannt to copy the reports
destination_path="./fMRIprep-reports-p3"
mkdir -p "$destination_path"
# Find all subject folders
pattern="sub-"
directories=$(find "$fMRIprep_path" -maxdepth 1 -type d -name "*$pattern*")
# Copy figure folders from subject folder (source) to destination
for source_folder in $directories; do
# Extract the sub-folder name (e.g., sub-01, sub-02)
sub_folder_name=$(basename "${source_folder}")
echo "Fetching reports for ${sub_folder_name}"
# Build the destination path
destination_folder="${destination_path}/${sub_folder_name}"
# Create destination folder if it doesn't exist
mkdir -p "${destination_folder}"
# Copy html file
cp "${fMRIprep_path}/${sub_folder_name}.html" "${destination_path}"
# Copy figure folders
cp -r "${source_folder}/figures" "${destination_folder}"
done
echo "All reports fetched successfully."