Created
March 23, 2024 11:11
-
-
Save ehzawad/2a3695d2c9aa12a497ffb28da1706119 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
merge_md_files() { | |
for dir in "$1"/*; do | |
if [ -d "$dir" ]; then | |
md_files=("$dir"/*.md) | |
if [ ${#md_files[@]} -gt 1 ]; then | |
merged_file="$dir/$(basename "$dir").md" | |
cat "${md_files[@]}" > "$merged_file" | |
fi | |
merge_md_files "$dir" | |
fi | |
done | |
} | |
merge_md_files "." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment