#! /bin/bash for dir in $(find ./neuroglancer-scripts-input/meshes/ -mindepth 1 -maxdepth 1 -type d) do output_json={} # exclude files that start with `.` e.g. .gitkeep etc for f in $(find $dir/meshes/ -type l -o -type f ! -name \\.* ) do pathedname=${f#$dir/meshes/} bname=$(basename $f) seg_id=$(echo $bname | sed -E -e 's/WHS_SD_rat_atlas_v4_0+//g' -e 's/\.[a-zA-Z]+$//g') # echo ${f#$dir/meshes/} final=$(echo $output_json | jq -c ". + {\"$pathedname\": { \"format\": \"STL_ASCII\", \"labelIndex\": $seg_id }}") output_json=$final done echo $output_json | jq '.' > $dir/manifest.json done