From d8d4b8349295efeee001193f353e76189c80a77d Mon Sep 17 00:00:00 2001 From: "Matheus A." Date: Sun, 6 Jul 2025 20:18:14 -0300 Subject: [PATCH] Updates some scripts --- scripts/shell/gdltool.sh | 4 ++-- scripts/shell/remove-lines-from-urls-txt.sh | 7 +++++-- scripts/shell/rename-all-files-to-md5sum.sh | 13 ++++++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/shell/gdltool.sh b/scripts/shell/gdltool.sh index f08527b..e4db354 100755 --- a/scripts/shell/gdltool.sh +++ b/scripts/shell/gdltool.sh @@ -59,7 +59,7 @@ furry_commission_ideas_path=/mnt/e/clouds/nextcloud/furry-downloads # furry_commission_ideas_path=/mnt/e/home/documents-unsorted/data-hoarding/furry-downloads # furry_commission_ideas_path=/mnt/e/home/downloads/furry-downloads furry_commission_ideas_urls_filename="urls.txt" -scripts_path=/home/cloud/repos/personal-devboot/scripts/shell +scripts_path=/home/cloud/git/personal-devboot/scripts/shell if [ ! -d $furry_commission_ideas_path ]; then echo "[ERROR] The images folder was not found (\"$furry_commission_ideas_path\")" @@ -231,7 +231,7 @@ existing_folders=() fill_existing_folders_array() { ignore_paths=("artists" "kinks" "ideas") - ignore_paths_depth_2=("artists" "favorites") + ignore_paths_depth_2=("artists") ignore_paths_depth_last=("no-source" ".bsky.social" "old" "mine") find_command="find * -type d" diff --git a/scripts/shell/remove-lines-from-urls-txt.sh b/scripts/shell/remove-lines-from-urls-txt.sh index 787bb9d..ac7748d 100755 --- a/scripts/shell/remove-lines-from-urls-txt.sh +++ b/scripts/shell/remove-lines-from-urls-txt.sh @@ -9,8 +9,11 @@ cat $urls_filename | while read line; do continue fi + if [ "$filename" == "." ]; then + continue + fi + echo "$filename does not exist" - sed -i "/$filename/d" $urls_filename + sed -i "/$filename/d" "$urls_filename" done - diff --git a/scripts/shell/rename-all-files-to-md5sum.sh b/scripts/shell/rename-all-files-to-md5sum.sh index 90524d7..e4ae628 100755 --- a/scripts/shell/rename-all-files-to-md5sum.sh +++ b/scripts/shell/rename-all-files-to-md5sum.sh @@ -5,17 +5,20 @@ if [ "$(pwd)" == "$HOME" ]; then exit 1 fi -mapfile -t files < <(find . -maxdepth 1 -type f -not -name 'desktop.ini') +mapfile -t files < <(find . -type f -not -name 'urls.txt' -not -name 'desktop.ini') -for filename in "${files[@]}"; do - filename_m5sum=$(md5sum "$filename" | awk '{print $1}') +for filepath in "${files[@]}"; do + filename=$(basename "$filepath") + filename_dir=$(dirname "$filepath") + + filename_md5sum=$(md5sum "$filepath" | awk '{print $1}') filename_extension="${filename##*.}" - new_filename="$filename_m5sum.$filename_extension" + new_filename="$filename_md5sum.$filename_extension" if [ "$filename" == "$new_filename" ]; then continue fi - mv "$filename" "$new_filename" + mv "$filepath" "$filename_dir/$new_filename" done