Mass file renaming containing nonASCII characters to ASCII
tools
Recently I found a problem with playing samba resources with VLC. Polish characters were breaking playback because
file could not be found. Strangely enough this happened only for files with lowercase Polish letters like ąśżźćłóęń
.
Removing those letters helped to fix playback on test file but I had more than one file to fix.
I tried to find a way to do rename all files quickly and easy and get rid of nonASCII characters and in this post I’m providing easiest, quickest and robust way to this.
Meet rename
rename
- This program renames files according to modification rules specified on the command line. If no filenames are given on the command line, a list of filenames will be expected on
standard input.
A lot of flags but one of them is especially useful -e/--expr
. This allow us to use regex to rename files.
Exactly what I was looking for.
So for example using:
-e 's/ż|Ż/Z/'
will replace lowercase and uppercase ź
with just Z
.
You can imagine the same can be done for Czech language or Chinese.
Snippets
- Change lowercase Polish characters to uppercase.
- Rename all files in current dir so they don’t have Polish characters.
- Remove all Polish characters from files in current directory.
3h4x