aboutsummaryrefslogtreecommitdiff
path: root/create_notes.sh
blob: 9965593971e3e15d5343518b577fcbae562ea2ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

org_path=$1

mkdir -p notes

cat graphdata.json |
jq -c '.data.nodes[]' |
while read -r nodes; do
  id=$(echo "${nodes}" | jq -r '.id')
  file=$(echo "${nodes}" | jq -r '.file') 
  timestamp=$(echo "${file}" | cut -d'-' -f1)
  matching_file=$(find "${org_path}" -name "${timestamp}-*.org" -type f)
  
  if [[ -f "${matching_file}" ]]; then
    cp -p "${matching_file}" "notes/${id}"
  fi
done