Via zsh. Enable zmv autoload zmv Replace all nont alpha-numeric chars with - zmv '(**/)(*)' '$1${2//[^A-Za-z0-9]/_}'