From: Steven Baltakatei Sandoval Date: Mon, 15 Jul 2024 21:40:39 +0000 (+0000) Subject: feat(user/zeropad.sh):Only rename files that need renaming X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/commitdiff_plain/2d366827080b9bd505c2558a721db66e46422cf9 feat(user/zeropad.sh):Only rename files that need renaming --- 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);