forked from Zettelkasten-Method/10000-markdown-files
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathupdate-files.sh
More file actions
executable file
·23 lines (20 loc) · 880 Bytes
/
update-files.sh
File metadata and controls
executable file
·23 lines (20 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Grab source
mkdir source
cd source
git clone https://github.com/Zettelkasten-Method/10000-markdown-files.git
# Update file naming convention
cd 10000-markdown-files/10000\ markdown\ files/
for f in *\ *; do mv "$f" "${f// /.}"; done
# Copy renamed notes into vault
cd ../../..
cp source/10000-markdown-files/10000\ markdown\ files/*.md notes/
# Add Dendron frontmatter to all notes other than root.md
ALL_NOTES=$(ls -lah notes/*.md | grep -v 'root.md' | cut -f10 -d' ')
for WORKING_FILE in $(echo "$ALL_NOTES"); do
echo $WORKING_FILE
NEW_ID=$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 25)
TITLE=$(echo $WORKING_FILE | cut -d'/' -f2 | sed 's:\.md::' | sed 's:.*\.::')
echo $TITLE
REPLACE="---\nid:\ $NEW_ID\ntitle:\ $TITLE\ndesc:\ Autogenerated\nupdated:\ 1662263181638\ncreated:\ 1662263090423\n---\n"
sed -i "1s/^/$REPLACE/" $WORKING_FILE
done