Created
June 7, 2023 15:02
-
-
Save hexadeciman/c2283f5d38d3bca28ff24ec003a524f0 to your computer and use it in GitHub Desktop.
Rename files in a directory from upper to lowercase
This file contains 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 | |
# Loop through all files in the directory | |
for file in *; do | |
# Check if the file exists and is a regular file | |
if [[ -f "$file" ]]; then | |
# Convert the file name to lowercase | |
lowercase_name=$(echo "$file" | tr '[:upper:]' '[:lower:]') | |
# Rename the file to lowercase | |
mv -i "$file" "$lowercase_name" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment