Skip to content

Instantly share code, notes, and snippets.

@oscarolbe
Created June 19, 2024 09:00
Show Gist options
  • Save oscarolbe/cf1caf3bb62216165aaedf35b9b568bf to your computer and use it in GitHub Desktop.
Save oscarolbe/cf1caf3bb62216165aaedf35b9b568bf to your computer and use it in GitHub Desktop.
#!/bin/bash
# Variables to define the string to find and the string to replace with
OLD_STRING="tenant"
NEW_STRING="domain"
# Find all directories recursively and rename them
find . -depth -type d -name "*${OLD_STRING}*" | while IFS= read -r dir; do
newdir=$(echo "$dir" | sed "s/${OLD_STRING}/${NEW_STRING}/g")
mv "$dir" "$newdir"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment