Skip to content

Instantly share code, notes, and snippets.

@hexadeciman
Created June 7, 2023 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hexadeciman/c2283f5d38d3bca28ff24ec003a524f0 to your computer and use it in GitHub Desktop.
Save hexadeciman/c2283f5d38d3bca28ff24ec003a524f0 to your computer and use it in GitHub Desktop.
Rename files in a directory from upper to lowercase
#!/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