diff --git a/30 Library/Lecture_10_-_compact.pdf b/30 Library/29622724 - Lecture_10_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_10_-_compact.pdf rename to 30 Library/29622724 - Lecture_10_-_compact.pdf diff --git a/30 Library/Lecture_11_-_compact.pdf b/30 Library/29622724 - Lecture_11_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_11_-_compact.pdf rename to 30 Library/29622724 - Lecture_11_-_compact.pdf diff --git a/30 Library/Lecture_1_-_compact.pdf b/30 Library/29622724 - Lecture_1_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_1_-_compact.pdf rename to 30 Library/29622724 - Lecture_1_-_compact.pdf diff --git a/30 Library/Lecture_2_-_compact.pdf b/30 Library/29622724 - Lecture_2_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_2_-_compact.pdf rename to 30 Library/29622724 - Lecture_2_-_compact.pdf diff --git a/30 Library/Lecture_3_-_compact.pdf b/30 Library/29622724 - Lecture_3_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_3_-_compact.pdf rename to 30 Library/29622724 - Lecture_3_-_compact.pdf diff --git a/30 Library/Lecture_4_-_compact.pdf b/30 Library/29622724 - Lecture_4_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_4_-_compact.pdf rename to 30 Library/29622724 - Lecture_4_-_compact.pdf diff --git a/30 Library/Lecture_5_-_compact.pdf b/30 Library/29622724 - Lecture_5_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_5_-_compact.pdf rename to 30 Library/29622724 - Lecture_5_-_compact.pdf diff --git a/30 Library/Lecture_6_-_compact.pdf b/30 Library/29622724 - Lecture_6_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_6_-_compact.pdf rename to 30 Library/29622724 - Lecture_6_-_compact.pdf diff --git a/30 Library/Lecture_7_-_compact.pdf b/30 Library/29622724 - Lecture_7_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_7_-_compact.pdf rename to 30 Library/29622724 - Lecture_7_-_compact.pdf diff --git a/30 Library/Lecture_8_-_compact.pdf b/30 Library/29622724 - Lecture_8_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_8_-_compact.pdf rename to 30 Library/29622724 - Lecture_8_-_compact.pdf diff --git a/30 Library/Lecture_9_-_compact.pdf b/30 Library/29622724 - Lecture_9_-_compact.pdf similarity index 100% rename from 30 Library/Lecture_9_-_compact.pdf rename to 30 Library/29622724 - Lecture_9_-_compact.pdf diff --git a/30 Library/normalize_name.sh b/30 Library/normalize_name.sh index ebef027..fae3327 100755 --- a/30 Library/normalize_name.sh +++ b/30 Library/normalize_name.sh @@ -1,6 +1,5 @@ #!/bin/bash -# Check if a filename was provided if [ -z "$1" ]; then echo "Usage: $0 " exit 1 @@ -8,29 +7,28 @@ fi TARGET="$1" -# Check if the file actually exists if [ ! -f "$TARGET" ]; then echo "Error: File '$TARGET' not found." exit 1 fi -# Get creation time (%W). -# Note: Returns 0 or '-' if the filesystem doesn't support birth time. +# Extract just the filename (e.g., "Lecture_1.pdf") +# and the directory path (e.g., ".") +FILENAME=$(basename "$TARGET") +DIRNAME=$(dirname "$TARGET") + BTIME=$(stat -c %W "$TARGET") -# Fallback to last modification time (%Y) if birth time is unavailable if [ "$BTIME" -eq 0 ] || [ "$BTIME" == "-" ]; then BTIME=$(stat -c %Y "$TARGET") fi -# Calculate the minute-based timestamp (equivalent to Math.floor(ms / 60000)) -# Since stat returns seconds, we divide by 60. FORMATTED_DATE=$(( BTIME / 60 )) -# Define the new name -NEW_NAME="${FORMATTED_DATE} - ${TARGET}" +# Construct the new name using ONLY the filename, +# then prepend the original directory path +NEW_NAME="${DIRNAME}/${FORMATTED_DATE} - ${FILENAME}" -# Perform the rename mv "$TARGET" "$NEW_NAME" echo "Renamed: '$TARGET' -> '$NEW_NAME'"