The files that come in have spaces, single quotes, brackets, square brackets etc.
I remove spaces and replace with dots with the following command
for file in *.mp4; do mv "$file" `echo $file | tr ' ' '.'` ; done
Then I remove special characters with the following command
rename -n 's/[^a-zA-Z0-9_-]//g' "$file"
But for some reason single quotes(') are still present in file names. Is there a way to have clean file names in one command?
In bash:
for file in *.mp4; do dest="${file//[[:space:]]/.}" && mv -i "$file" "${dest//[^[:alnum:]._-]/}"; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With