Rename files in current directory to not have special characters

for f in *; do nf=$(printf '%s' "$f" | sed 's|[^a-zA-Z0-9 ._-]||g;s|^[ -_]\+||'); [ "$f" != "$nf" ] && mv -n -- "$f" "$nf"; done

No comments: