From 11db48df0462ea30dc1de62a0ffb8090dc20e92d Mon Sep 17 00:00:00 2001 From: sneedgroup-holder Date: Mon, 4 Nov 2024 01:19:41 +0000 Subject: [PATCH] add videos to gitignore --- .gitignore | 1 + treer.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 treer.sh diff --git a/.gitignore b/.gitignore index 958648e..8b0c4e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ code/*.tar.gz log/index.gmi +videos/video-directory diff --git a/treer.sh b/treer.sh new file mode 100755 index 0000000..9f8b97e --- /dev/null +++ b/treer.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Check for directory argument +if [ -z "$1" ]; then + echo "Usage: $0 /path/to/directory" + exit 1 +fi + +# Define the directory you want to scan +DIRECTORY="$1" + +# Output file +OUTPUT_FILE="$2" + +# Start the .gmi file +echo "# Tree of files in $DIRECTORY" > "$OUTPUT_FILE" +echo "" >> "$OUTPUT_FILE" + +# Function to recursively list files +list_files() { + local dir="$1" + local prefix="$2" + for file in "$dir"/*; do + if [ -d "$file" ]; then + echo "=> $prefix${file##*/} ${file##*/}" >> "$OUTPUT_FILE" + list_files "$file" "$prefix${file##*/}/" + elif [ -f "$file" ]; then + echo "=> $prefix${file##*/} ${file##*/}" >> "$OUTPUT_FILE" + fi + done +} + +# Call the function +list_files "$DIRECTORY" "" + +echo "Tree structure written to $OUTPUT_FILE"