aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcreate_notes.sh20
1 files changed, 9 insertions, 11 deletions
diff --git a/create_notes.sh b/create_notes.sh
index cf1112e..1760018 100755
--- a/create_notes.sh
+++ b/create_notes.sh
@@ -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 \ No newline at end of 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