strangely the encodings from some music I got from a friend with Windows 7 OS show up with a wrong encoding in nautlius . I already tried it with

convmv --notest -r -f windows-1255 -t utf-8 *

but it didn't fix it. It rather but another wrong encoding. I tried also with latin1 and latin3. Since I don't know what the original encoding was and I can't find that out, I keep wondering what my options are.

Thx for any advice.

  • if the files are mp3 they may hold strings inside the file with the artist and so on for you to recreate the filename. see id3info or similar tools. – meuh Sep 20 '15 at 7:00
  • @meuh Yes they are mp3. id3info gives me: *** mp3 info MPEG1/layer III Bitrate: 192KBps Frequency: 44KHz – joaoal Sep 20 '15 at 17:07
  • that's a pity. typically id3info would find "tags" like TIT2 Title, TALB Album, and so on, but it doesnt seem like your files hold this information. – meuh Sep 20 '15 at 17:22
  • ok i tried out with other songs. It gives me: === TIT2 (Title/songname/content description): 22 - Selegco de Pagode and === TALB (Album/Movie/Show title): CD Jads e Jadson - Ao Vivo em Maringa but where is the encoding? – joaoal Sep 20 '15 at 17:26
  • I thought you might just ignore the original file names and rename the files from the id3 tag info. – meuh Sep 20 '15 at 17:31

To try all the encodings, choose one of your files, eg mychosenfile.mp3m, and then loop through all the encodings. With luck you will find one that seems to be ok. This just lists the possible new names:

for enc in $(convmv --list)
do  echo $enc: $(convmv --parsable -f $enc -t utf-8 "$file")

Alternatively, you can rename the files to the song track and title taken from the id3 tag if they have one. For example, (this just echo's the mv command):

find mydir -name '*.mp3' |
while read file
do if newname="$(id3info "$file" |
        awk -F': ' '
         /^=== TRCK/{ track = $2 }
         /^=== TIT2/{ title=$2;gsub(" ","_",title) }
         END        { if(title!="")printf "%02d_%s.mp3\n",track,title }
   then dir=$(dirname "$file")
        echo mv "$file" "$dir/$newname"
  • thanks for your tips. I tried the first trick. quite nice. unfortunately it did not give any satisfactory result. the second one with renaming wont work because also the encoding inside the fileinfo is wrong...unfortunatly. – joaoal Sep 20 '15 at 23:13

To remove special characters from all filenames, use detox:

detox -r -v -s utf8 /path/to/files/

You may also pass -n to see what it will done and verify it sounds sensible.

To rename all files according to their music tags, use lltag:

lltag -R --mp3v2 --mp3read=21 --rename '/new/path/%a/%A/%n %t' /path/to/files

You should consider passing --dry-run to first invocation to see what will be done; pass --yes if you are tired of answering questions (might affect quality of new names in case of missing tags and the like).

More details are in man detox and man lltag.

  • since I do not know which encoding the file is, detox produces wrong results. Something that should be é but was displayed as | now appears as _ .... the problem is that also inside the mp3 tags the encoding is wrong so lltag won't do the job as well... but thanks for the efforts. detox is good to remember for other tasks. – joaoal Sep 20 '15 at 23:01
  • detox is used to change all problematic characters in file names to something that other tools will handle. If you don't like what it produces, you can rename files later on; probably automatically, but first you need to fix tags. You can try easytag (GUI app). It can try decode tag using specified encoding, so after some back and forth you might finally figure out what encoding this is and convert it to UTF8 (easytag will do that). Then you can rename all files according to tags - using lltag or easytag. – Mirek Długosz Sep 21 '15 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.