41 lines
955 B
Bash
Executable File
41 lines
955 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# define the target dir
|
|
parent="$(dirname "${BASH_SOURCE[0]}")"
|
|
cd "$parent"; cd ../../../
|
|
directory="$(pwd -P)"
|
|
|
|
today="$(date "+%Y-%m-%d")"
|
|
|
|
printf "Date: %s\n" "$today"
|
|
|
|
for dirs in "$directory"/*; do
|
|
string="$(printf "---\n")"
|
|
area="$(basename "${dirs}")"
|
|
if [ "$area" != "System Volume Information" ]; then
|
|
|
|
string="$(printf "%stitle: %s\n" "$string" "$area")"
|
|
string="$(printf "%sdate: %s\n" "$string" "$today")"
|
|
string="$(printf "%s---\n\n" "$string")"
|
|
|
|
for cats in "$dirs"/*; do
|
|
category="$(basename "$cats")"
|
|
string="$(printf "%s# %s\n\n" "$string" "$category")"
|
|
|
|
for ids in "$cats"/*; do
|
|
ident="$(basename "$ids")"
|
|
string="$(printf "%s* %s\n" "$string" "$ident")"
|
|
done
|
|
|
|
string="$(printf "%s\n" "$string")"
|
|
done
|
|
|
|
savedir="$directory/00-09 Index/00 Index/00.01 Index/"
|
|
fname="${area:0:5}.md"
|
|
fullpath="$savedir$fname"
|
|
|
|
printf '%s\n' "$fullpath"
|
|
printf '%s' "$string" > "$fullpath"
|
|
fi
|
|
done
|