Click to See Complete Forum and Search --> : How to automatically shorten long file name ?


anton
06-09-2003, 10:41 PM
Hello,

I have some mp3s that have long file names :( ... when I burn them to CDs, program just removes the extension if the name is too long :( ... and then mp3 players don't see this file :( ...

so, how can I shorten automatically all filenames that are longer that 37 characters, but keep the extension ... ?

Thanks :)

rid3r
06-09-2003, 11:06 PM
Taken from here: http://www.oreilly.com/catalog/linuxsvrhack/

#!/bin/bash
# the "dealbumize" script from "Linux Server Hacks"
# by Rob Flickenger
for x in *; do
echo -n $x; echo -ne '\000'
echo -n `echo $x | cut -f 1 -d '-'`; echo -n ' - '
echo -n `echo $x | cut -f 3- -d '-'`; echo -ne '\000'
done; xargs -0 -n2 mv

Put it in /usr/local/bin, and try to run it on a few mp3 files:
$ cd Test_mp3_dir
$ dealbumize

bwkaz
06-10-2003, 09:23 PM
You'd turn on either Rock Ridge or Joliet extensions (or both) when you burn the CD, and it'll keep the long filenames. Then you don't have to worry about this truncation at all.

:D