Created
April 26, 2024 11:53
-
-
Save bhumit070/5f369027f57b7f91d4588c136ea5faf1 to your computer and use it in GitHub Desktop.
Replace space with dots
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
for file in *; do | |
# Check if the file name contains spaces | |
if [[ "$file" == *" "* ]]; then | |
# Replace spaces with dots and rename the file | |
new_name=$(echo "$file" | tr ' ' '.') | |
mv "$file" "$new_name" | |
echo "Renamed '$file' to '$new_name'" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment