#!/bin/bash # Define the main directories and their corresponding file types declare -A directories=( ["Correos"]="eml" ["Llaves"]="pem crt" ["Sellos"]="tsq tsr" ["Pdf's"]="pdf" ) # Define the base directory base_dir="$(pwd)" # Start creating the index.html file index_file="$base_dir/index.html" echo " villalba.is.eu.org
" > "$index_file" echo "

Index

" >> "$index_file" # Loop through each directory type for dir in "${!directories[@]}"; do echo "

$dir

" >> "$index_file" echo "
" >> "$index_file" # Loop through each file type for the current directory for ext in ${directories[$dir]}; do # Find files with the current extension and list them files=("$base_dir"/*.$ext) if [ -e "${files[0]}" ]; then # Check if there are any files for file in "${files[@]}"; do echo "

"$(basename "$file")"

" >> "$index_file" done fi done done pandoc info.md -o info.html cat info.html >> "$index_file" echo "
" >> "$index_file"