3 # $Id: netatalkshorternamelinks.pl,v 1.2 2001-05-07 14:16:47 rufustfirefly Exp $
5 # (c) 2000 Christian Wolff, scarabaeus@scarabaeus.org
6 # quick hack to create symbolic links for files with names over 31 chars long
9 $searchpath='/data/mp3/';
10 $destpath='/data/mac_mp3/';
13 `rm -rf ${destpath}*`;
14 foreach $f (`find $searchpath -name '*.mp3'`) {
17 if ($f=~/^(.*)\/(.*)$/) {
18 ($path,$file)=($1,$2);
20 ($path,$file)=('',$f);
23 for $splitpath (split /\//,$path) {
24 if (length $splitpath > 31) {
25 # keep the last 2 chars of the directory name
26 $splitpath=substr($splitpath,0,29).substr($splitpath,-2,2);
28 $shortpath.="${splitpath}/";
29 mkdir $destpath.$shortpath,0755;
32 if (length $file > 31) {
33 # keep the extension of 4 chars
34 $shortfile=substr($file,0,27).substr($file,-4,4);
36 `ln -sf ${searchpath}${f} ${destpath}${shortpath}${shortfile}`;