add rename folders with dost function to bash aliases

ads
This commit is contained in:
lucas committed 2026-10-01 14:07:19 +00:00
1 parent f8f0fd6fad
commit 73cb3802fb
1 file changed
+26
+26
View File
@@ -213,3 +213,29 @@ find_multi_video_dirs() {
fi
done
}
rename_dots() {
find . -depth | while IFS= read -r path; do
[[ "$path" == "." ]] && continue
base=$(basename "$path")
dir=$(dirname "$path")
if [[ -f "$path" && "$base" == *.tar.gz ]]; then
name="${base%.tar.gz}"
newbase="${name//./ }.tar.gz"
elif [[ -f "$path" && "$base" == *.* ]]; then
name="${base%.*}"
ext="${base##*.}"
newbase="${name//./ }.${ext}"
else
newbase="${base//./ }"
fi
if [[ "$base" != "$newbase" ]]; then
newpath="$dir/$newbase"
echo "Moving: '$path' -> '$newpath'"
mv -n -- "$path" "$newpath"
fi
done
}