diff options
Diffstat (limited to 'rename.sh')
-rwxr-xr-x | rename.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/rename.sh b/rename.sh new file mode 100755 index 000000000..84906842d --- /dev/null +++ b/rename.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Define old and new strings +old="yuzu" +new="citron" + +# Find and rename directories first +find . -depth -type d -name "*${old}*" | while read -r dir; do + newdir=$(echo "$dir" | sed "s/${old}/${new}/g") + mv "$dir" "$newdir" +done + +# Find and rename files +find . -depth -type f -name "*${old}*" | while read -r file; do + newfile=$(echo "$file" | sed "s/${old}/${new}/g") + mv "$file" "$newfile" +done |