rewrite in go

This commit is contained in:
raf 2023-10-27 10:01:55 +03:00
commit 05642cb93b
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
743 changed files with 334055 additions and 55 deletions

29
test.sh Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Directory containing the images
image_directory="images"
# Set the starting number
number=0
# Set the maximum number for renaming (change this to your desired limit)
max_number=100
# Loop through the image files in the directory and rename them
for image in "$image_directory"/*; do
# Check if we've reached the maximum number
if [ "$number" -gt "$max_number" ]; then
echo "Reached the maximum number for renaming."
break
fi
# Get the file extension
extension="${image##*.}"
# Rename the image with the current number
new_name="${image_directory}/${number}.${extension}"
mv "$image" "$new_name"
# Increment the number
number=$((number + 1))
done