Created
March 13, 2024 07:13
-
-
Save plskz/d594e26d74e02dd4dfb4ed0d4b195572 to your computer and use it in GitHub Desktop.
update folder name for my-threejs-journey repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Target starting number for renaming (start at 64) | |
start_number=64 | |
# Iterate through folders in reverse, starting with folder number 51 | |
for i in {51..32}; do | |
old_name="${i}-" # Build the old folder name pattern | |
# Check if the folder exists | |
if [ -d "$old_name"* ]; then | |
folder_base_name=$(basename "$old_name"*) # Get just the base folder name | |
folder_base_name="${folder_base_name#*-}" # Remove the old number prefix | |
new_name="${start_number}-${folder_base_name}" # Build the new name | |
mv "$old_name"* "$new_name" # Perform the renaming | |
echo "Renamed $old_name to $new_name" | |
((start_number--)) # Decrement the target number | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chmod +x rename.sh