Skip to content

Instantly share code, notes, and snippets.

@bhumit070
Created April 26, 2024 11:53
Show Gist options
  • Save bhumit070/5f369027f57b7f91d4588c136ea5faf1 to your computer and use it in GitHub Desktop.
Save bhumit070/5f369027f57b7f91d4588c136ea5faf1 to your computer and use it in GitHub Desktop.
Replace space with dots
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