-
-
Save santerref/8b63b4fce0d6a73bc933482885d6b04a to your computer and use it in GitHub Desktop.
batch in bash to replace accents in filenames
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# slugify.sh by Ronan | |
# | |
# Distributed under terms of the MIT license. | |
# | |
for file in *.mp4; do | |
filename=${file%.*} | |
file_clean=`echo $filename | iconv -c -f utf8 -t ascii//TRANSLIT | sed -e "s/'//g" | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z` | |
final="$file_clean.mp4" | |
mv "$file" "$final" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment