From 2d366827080b9bd505c2558a721db66e46422cf9 Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Mon, 15 Jul 2024 21:40:39 +0000 Subject: [PATCH 1/1] feat(user/zeropad.sh):Only rename files that need renaming --- user/zeropad.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user/zeropad.sh b/user/zeropad.sh index 761fd30..e008b71 100755 --- a/user/zeropad.sh +++ b/user/zeropad.sh @@ -1,7 +1,7 @@ #!/bin/bash # Desc: Zero-pad working dir files with initial digits for sorting # Usage: zeropad.sh -# Version: 0.0.4 +# Version: 0.0.5 list_files() { # Desc: Lists working directory file basenames @@ -27,6 +27,7 @@ main () { # Construct the new filename new_file="${padded_digits}${file#${digits}}"; # Rename the file + if [[ "$file" == "$new_file" ]]; then continue; fi; mv -n "$file" "$new_file" # declare -p file new_file; # debug done < <(list_files); -- 2.30.2