Skip to content

Commit

Permalink
Refactor create_notes.sh script to use timestamp-based file matching
Browse files Browse the repository at this point in the history
  • Loading branch information
ikoamu committed Jan 27, 2024
1 parent 759b084 commit c7c279c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions create_notes.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
#!/bin/bash

orgPath=$1
org_path=$1

mkdir -p notes

# cat graphdata.json

ls -ls "${orgPath}"

cat graphdata.json |
jq -c '.data.nodes[]' |
while read -r nodes; do
id=$(echo "${nodes}" | jq -r '.id')
file=$(echo "${nodes}" | jq -r '.file')
echo "============================="
echo "id: ${id}"
echo "file: ${file}"
cat "${orgPath}/${file}"

cp -p "${orgPath}/${file}" "notes/${id}"
done

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

0 comments on commit c7c279c

Please sign in to comment.