From 5fe5e8106cefc7627b157d815fe498a272f2219c Mon Sep 17 00:00:00 2001 From: Hyperling Date: Fri, 7 Jun 2024 19:18:30 -0700 Subject: [PATCH] Also remove double whitespace. --- rename_music_files.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rename_music_files.sh b/rename_music_files.sh index 0c437b7..6dd0026 100755 --- a/rename_music_files.sh +++ b/rename_music_files.sh @@ -95,7 +95,7 @@ avg_time=0 total_time=0 time_count=0 est_guess=0 -time find $DIR -name "*${EXT}" | while read file; do +time find $DIR -name "*${EXT}" | sort | while read file; do count=$(( count + 1 )) echo -e "\n$file" @@ -122,6 +122,9 @@ time find $DIR -name "*${EXT}" | while read file; do title="${title// : /}" title="${title//[^[:alnum:][:space:].]/}" title="`echo $title`" + while [[ "$title" == *" "* ]]; do + title="${title// / }" + done echo "Title=$title" # Create the new file with the correct filename. @@ -138,7 +141,8 @@ time find $DIR -name "*${EXT}" | while read file; do echo "No Track# found, leaving Title alone." continue else - error "File does not have Track or Title metadata. Are you sure you're running this on music?" 3 + echo "File does not have Track or Title metadata." + continue fi # Confirm the new file exists and remove the old file if so