diff --git a/300s School/!TOC.md b/300s School/!TOC.md deleted file mode 100644 index 4ece95701..000000000 --- a/300s School/!TOC.md +++ /dev/null @@ -1,65 +0,0 @@ -# Table of Contents for . - -## Subdirectories -- [[ME/!TOC]] -- [[2016/!TOC]] -- [[-/!TOC]] -- [[Nonlinear/!TOC]] -- [[Dynamical/!TOC]] -- [[Systems/!TOC]] -- [[1/!TOC]] -- [[ME/!TOC]] -- [[2046/!TOC]] -- [[-/!TOC]] -- [[Digital/!TOC]] -- [[Control/!TOC]] -- [[Theory/!TOC]] -- [[ME/!TOC]] -- [[2085/!TOC]] -- [[-/!TOC]] -- [[Graduate/!TOC]] -- [[Seminar/!TOC]] -- [[ME/!TOC]] -- [[2150/!TOC]] -- [[-/!TOC]] -- [[High/!TOC]] -- [[Assurance/!TOC]] -- [[Cyber-Physical/!TOC]] -- [[Systems/!TOC]] -- [[ME/!TOC]] -- [[3100/!TOC]] -- [[-/!TOC]] -- [[Engineering/!TOC]] -- [[Research/!TOC]] -- [[and/!TOC]] -- [[Leadership/!TOC]] -- [[Management/!TOC]] -- [[NUCE/!TOC]] -- [[2100/!TOC]] -- [[-/!TOC]] -- [[Fundamentals/!TOC]] -- [[of/!TOC]] -- [[Nuclear/!TOC]] -- [[Engineering/!TOC]] -- [[NUCE/!TOC]] -- [[2103/!TOC]] -- [[-/!TOC]] -- [[Integration/!TOC]] -- [[of/!TOC]] -- [[Plant/!TOC]] -- [[Systems/!TOC]] -- [[with/!TOC]] -- [[the/!TOC]] -- [[Reactor/!TOC]] -- [[Core/!TOC]] -- [[NUCE/!TOC]] -- [[2113/!TOC]] -- [[-/!TOC]] -- [[Radiation/!TOC]] -- [[Detection/!TOC]] -- [[and/!TOC]] -- [[Measurement/!TOC]] - -## Files -- [[reddup.sh]] - diff --git a/300s School/ME 2016 - Nonlinear Dynamical Systems 1/2024-09-09/!TOC.md b/300s School/ME 2016 - Nonlinear Dynamical Systems 1/2024-09-09/README - 2024-09-09.md similarity index 98% rename from 300s School/ME 2016 - Nonlinear Dynamical Systems 1/2024-09-09/!TOC.md rename to 300s School/ME 2016 - Nonlinear Dynamical Systems 1/2024-09-09/README - 2024-09-09.md index 6d698ce9d..9ad83de7c 100644 --- a/300s School/ME 2016 - Nonlinear Dynamical Systems 1/2024-09-09/!TOC.md +++ b/300s School/ME 2016 - Nonlinear Dynamical Systems 1/2024-09-09/README - 2024-09-09.md @@ -1,3 +1,4 @@ + # Table of Contents for 2024-09-09 ## Files diff --git a/300s School/ME 2016 - Nonlinear Dynamical Systems 1/!TOC.md b/300s School/ME 2016 - Nonlinear Dynamical Systems 1/README - ME 2016 - Nonlinear Dynamical Systems 1.md similarity index 92% rename from 300s School/ME 2016 - Nonlinear Dynamical Systems 1/!TOC.md rename to 300s School/ME 2016 - Nonlinear Dynamical Systems 1/README - ME 2016 - Nonlinear Dynamical Systems 1.md index 58b7d0716..c5d5bacf5 100644 --- a/300s School/ME 2016 - Nonlinear Dynamical Systems 1/!TOC.md +++ b/300s School/ME 2016 - Nonlinear Dynamical Systems 1/README - ME 2016 - Nonlinear Dynamical Systems 1.md @@ -1,8 +1,9 @@ + # Table of Contents for ME 2016 - Nonlinear Dynamical Systems 1 ## Subdirectories -- [[2024-09-09/!TOC]] -- [[images/!TOC]] +- [[2024-09-09/README - 2024-09-09]] +- [[images/README - images]] ## Files - [[2024-08-26]] diff --git a/300s School/ME 2016 - Nonlinear Dynamical Systems 1/images/!TOC.md b/300s School/ME 2016 - Nonlinear Dynamical Systems 1/images/README - images.md similarity index 99% rename from 300s School/ME 2016 - Nonlinear Dynamical Systems 1/images/!TOC.md rename to 300s School/ME 2016 - Nonlinear Dynamical Systems 1/images/README - images.md index 90beb5dea..4565a6026 100644 --- a/300s School/ME 2016 - Nonlinear Dynamical Systems 1/images/!TOC.md +++ b/300s School/ME 2016 - Nonlinear Dynamical Systems 1/images/README - images.md @@ -1,3 +1,4 @@ + # Table of Contents for images ## Files diff --git a/300s School/ME 2046 - Digital Control Theory/!TOC.md b/300s School/ME 2046 - Digital Control Theory/README - ME 2046 - Digital Control Theory.md similarity index 99% rename from 300s School/ME 2046 - Digital Control Theory/!TOC.md rename to 300s School/ME 2046 - Digital Control Theory/README - ME 2046 - Digital Control Theory.md index bcfea7713..708221eba 100644 --- a/300s School/ME 2046 - Digital Control Theory/!TOC.md +++ b/300s School/ME 2046 - Digital Control Theory/README - ME 2046 - Digital Control Theory.md @@ -1,3 +1,4 @@ + # Table of Contents for ME 2046 - Digital Control Theory ## Files diff --git a/300s School/ME 2085 - Graduate Seminar/!TOC.md b/300s School/ME 2085 - Graduate Seminar/README - ME 2085 - Graduate Seminar.md similarity index 99% rename from 300s School/ME 2085 - Graduate Seminar/!TOC.md rename to 300s School/ME 2085 - Graduate Seminar/README - ME 2085 - Graduate Seminar.md index e0726aeab..fb0835394 100644 --- a/300s School/ME 2085 - Graduate Seminar/!TOC.md +++ b/300s School/ME 2085 - Graduate Seminar/README - ME 2085 - Graduate Seminar.md @@ -1,3 +1,4 @@ + # Table of Contents for ME 2085 - Graduate Seminar ## Files diff --git a/300s School/ME 2150 - High Assurance Cyber-Physical Systems/!TOC.md b/300s School/ME 2150 - High Assurance Cyber-Physical Systems/README - ME 2150 - High Assurance Cyber-Physical Systems.md similarity index 99% rename from 300s School/ME 2150 - High Assurance Cyber-Physical Systems/!TOC.md rename to 300s School/ME 2150 - High Assurance Cyber-Physical Systems/README - ME 2150 - High Assurance Cyber-Physical Systems.md index 20b918c12..e1a2704a3 100644 --- a/300s School/ME 2150 - High Assurance Cyber-Physical Systems/!TOC.md +++ b/300s School/ME 2150 - High Assurance Cyber-Physical Systems/README - ME 2150 - High Assurance Cyber-Physical Systems.md @@ -1,3 +1,4 @@ + # Table of Contents for ME 2150 - High Assurance Cyber-Physical Systems ## Files diff --git a/300s School/ME 3100 - Engineering Research and Leadership Management/!TOC.md b/300s School/ME 3100 - Engineering Research and Leadership Management/README - ME 3100 - Engineering Research and Leadership Management.md similarity index 99% rename from 300s School/ME 3100 - Engineering Research and Leadership Management/!TOC.md rename to 300s School/ME 3100 - Engineering Research and Leadership Management/README - ME 3100 - Engineering Research and Leadership Management.md index 5ca3b9a24..aea064d99 100644 --- a/300s School/ME 3100 - Engineering Research and Leadership Management/!TOC.md +++ b/300s School/ME 3100 - Engineering Research and Leadership Management/README - ME 3100 - Engineering Research and Leadership Management.md @@ -1,3 +1,4 @@ + # Table of Contents for ME 3100 - Engineering Research and Leadership Management ## Files diff --git a/300s School/NUCE 2100 - Fundamentals of Nuclear Engineering/!TOC.md b/300s School/NUCE 2100 - Fundamentals of Nuclear Engineering/README - NUCE 2100 - Fundamentals of Nuclear Engineering.md similarity index 99% rename from 300s School/NUCE 2100 - Fundamentals of Nuclear Engineering/!TOC.md rename to 300s School/NUCE 2100 - Fundamentals of Nuclear Engineering/README - NUCE 2100 - Fundamentals of Nuclear Engineering.md index 7ce51047d..1ad949a43 100644 --- a/300s School/NUCE 2100 - Fundamentals of Nuclear Engineering/!TOC.md +++ b/300s School/NUCE 2100 - Fundamentals of Nuclear Engineering/README - NUCE 2100 - Fundamentals of Nuclear Engineering.md @@ -1,3 +1,4 @@ + # Table of Contents for NUCE 2100 - Fundamentals of Nuclear Engineering ## Files diff --git a/300s School/NUCE 2103 - Integration of Plant Systems with the Reactor Core/!TOC.md b/300s School/NUCE 2103 - Integration of Plant Systems with the Reactor Core/README - NUCE 2103 - Integration of Plant Systems with the Reactor Core.md similarity index 99% rename from 300s School/NUCE 2103 - Integration of Plant Systems with the Reactor Core/!TOC.md rename to 300s School/NUCE 2103 - Integration of Plant Systems with the Reactor Core/README - NUCE 2103 - Integration of Plant Systems with the Reactor Core.md index ba15d1c46..498c2775e 100644 --- a/300s School/NUCE 2103 - Integration of Plant Systems with the Reactor Core/!TOC.md +++ b/300s School/NUCE 2103 - Integration of Plant Systems with the Reactor Core/README - NUCE 2103 - Integration of Plant Systems with the Reactor Core.md @@ -1,3 +1,4 @@ + # Table of Contents for NUCE 2103 - Integration of Plant Systems with the Reactor Core ## Files diff --git a/300s School/NUCE 2113 - Radiation Detection and Measurement/!TOC.md b/300s School/NUCE 2113 - Radiation Detection and Measurement/README - NUCE 2113 - Radiation Detection and Measurement.md similarity index 99% rename from 300s School/NUCE 2113 - Radiation Detection and Measurement/!TOC.md rename to 300s School/NUCE 2113 - Radiation Detection and Measurement/README - NUCE 2113 - Radiation Detection and Measurement.md index 1e84dfd57..cf007237c 100644 --- a/300s School/NUCE 2113 - Radiation Detection and Measurement/!TOC.md +++ b/300s School/NUCE 2113 - Radiation Detection and Measurement/README - NUCE 2113 - Radiation Detection and Measurement.md @@ -1,3 +1,4 @@ + # Table of Contents for NUCE 2113 - Radiation Detection and Measurement ## Files diff --git a/300s School/README - ..md b/300s School/README - ..md new file mode 100644 index 000000000..0f113a8b5 --- /dev/null +++ b/300s School/README - ..md @@ -0,0 +1,66 @@ + +# Table of Contents for . + +## Subdirectories +- [[ME/README - ME]] +- [[2016/README - 2016]] +- [[-/README - -]] +- [[Nonlinear/README - Nonlinear]] +- [[Dynamical/README - Dynamical]] +- [[Systems/README - Systems]] +- [[1/README - 1]] +- [[ME/README - ME]] +- [[2046/README - 2046]] +- [[-/README - -]] +- [[Digital/README - Digital]] +- [[Control/README - Control]] +- [[Theory/README - Theory]] +- [[ME/README - ME]] +- [[2085/README - 2085]] +- [[-/README - -]] +- [[Graduate/README - Graduate]] +- [[Seminar/README - Seminar]] +- [[ME/README - ME]] +- [[2150/README - 2150]] +- [[-/README - -]] +- [[High/README - High]] +- [[Assurance/README - Assurance]] +- [[Cyber-Physical/README - Cyber-Physical]] +- [[Systems/README - Systems]] +- [[ME/README - ME]] +- [[3100/README - 3100]] +- [[-/README - -]] +- [[Engineering/README - Engineering]] +- [[Research/README - Research]] +- [[and/README - and]] +- [[Leadership/README - Leadership]] +- [[Management/README - Management]] +- [[NUCE/README - NUCE]] +- [[2100/README - 2100]] +- [[-/README - -]] +- [[Fundamentals/README - Fundamentals]] +- [[of/README - of]] +- [[Nuclear/README - Nuclear]] +- [[Engineering/README - Engineering]] +- [[NUCE/README - NUCE]] +- [[2103/README - 2103]] +- [[-/README - -]] +- [[Integration/README - Integration]] +- [[of/README - of]] +- [[Plant/README - Plant]] +- [[Systems/README - Systems]] +- [[with/README - with]] +- [[the/README - the]] +- [[Reactor/README - Reactor]] +- [[Core/README - Core]] +- [[NUCE/README - NUCE]] +- [[2113/README - 2113]] +- [[-/README - -]] +- [[Radiation/README - Radiation]] +- [[Detection/README - Detection]] +- [[and/README - and]] +- [[Measurement/README - Measurement]] + +## Files +- [[reddup.sh]] + diff --git a/300s School/reddup.sh b/300s School/reddup.sh index 4995d31eb..30474e71e 100755 --- a/300s School/reddup.sh +++ b/300s School/reddup.sh @@ -1,64 +1,82 @@ #!/bin/bash -# This script recursively creates a table-of-contents file named !TOC.md in every directory -# under the current folder (e.g., your school folder). Each !TOC.md file will include: -# - A header with the directory name. -# - A list of immediate subdirectories (alphabetically sorted) as links to that subdirectory’s own !TOC. -# - A list of immediate files (alphabetically sorted) as links. +# ------------------------------------------------------------------ +# Author: ChatGPT +# Generated on: $(date '+%Y-%m-%d') # -# IMPORTANT: -# - This script assumes that folder and file names do not include newline characters. -# - It uses bash arrays and assumes GNU coreutils are available. +# This script deletes existing README files matching "README - *.md" +# and then recursively creates a table-of-contents README file in +# each directory. The file is named "README - {Folder Name}.md". +# +# Each README includes: +# - An author/date header. +# - A header with the folder's name. +# - An alphabetically sorted list of immediate subdirectories, +# with links to that subdirectory’s own README. +# - An alphabetically sorted list of immediate files (excluding +# the generated README). +# +# It is written to handle blank spaces in file and folder names. +# ------------------------------------------------------------------ -# Set the base directory. Change "." if needed. +# Delete any existing README files matching "README - *.md" +find . -type f -name 'README - *.md' -delete + +# Set the base directory (change "." if necessary) base_dir="." -find . -type f \( -iname "!TOC.md" -o -iname "README.md" \) -delete # Recursively find every directory starting from base_dir. find "$base_dir" -type d -print0 | while IFS= read -r -d '' dir; do - toc="$dir/!TOC.md" + # Get the folder's base name (tolerant of spaces) + base=$(basename "$dir") + # Define the path for the README file. Format: "README - {Folder Name}.md" + readme="$dir/README - ${base}.md" - # Write header into !TOC.md - echo "# Table of Contents for $(basename "$dir")" > "$toc" - echo "" >> "$toc" + # Write the header into the README file, including author attribution and date. + { +# echo "Generated by ChatGPT on $(date '+%Y-%m-%d')" + echo "" + echo "# Table of Contents for ${base}" + echo "" + } > "$readme" ######################### # Process Subdirectories ######################### subdirs=() - # Find immediate subdirectories (depth 1) + # Find immediate subdirectories (depth 1) in the current directory. while IFS= read -r -d '' subdir; do - # Save only the basename of the subdirectory subdirs+=( "$(basename "$subdir")" ) done < <(find "$dir" -mindepth 1 -maxdepth 1 -type d -print0) if [ ${#subdirs[@]} -gt 0 ]; then - # Sort the subdirectory names alphabetically + # Sort subdirectory names alphabetically. sorted_subdirs=($(printf "%s\n" "${subdirs[@]}" | sort)) - echo "## Subdirectories" >> "$toc" + echo "## Subdirectories" >> "$readme" for sub in "${sorted_subdirs[@]}"; do - # Link to the !TOC file inside the subdirectory - echo "- [[${sub}/!TOC]]" >> "$toc" + # Link to the subdirectory's README file. + # The link format: [[Subfolder/README - Subfolder]] + echo "- [[${sub}/README - ${sub}]]" >> "$readme" done - echo "" >> "$toc" + echo "" >> "$readme" fi ################# # Process Files ################# files=() - # Find immediate files (depth 1), excluding the !TOC.md file itself. + # Find immediate files (depth 1), excluding the generated README file. while IFS= read -r -d '' file; do files+=( "$(basename "$file")" ) - done < <(find "$dir" -mindepth 1 -maxdepth 1 -type f ! -iname "!TOC.md" -print0) + done < <(find "$dir" -mindepth 1 -maxdepth 1 -type f ! -path "$readme" -print0) if [ ${#files[@]} -gt 0 ]; then - # Sort the file names alphabetically + # Sort file names alphabetically. sorted_files=($(printf "%s\n" "${files[@]}" | sort)) - echo "## Files" >> "$toc" + echo "## Files" >> "$readme" for f in "${sorted_files[@]}"; do - echo "- [[${f}]]" >> "$toc" + echo "- [[${f}]]" >> "$readme" done - echo "" >> "$toc" + echo "" >> "$readme" fi done