From: rufustfirefly Date: Mon, 7 May 2001 14:15:42 +0000 (+0000) Subject: added script to shorten names X-Git-Tag: netatalk-1-5-rc1~435 X-Git-Url: https://arthur.barton.de/gitweb/?a=commitdiff_plain;h=35dc111cc6c927a8c6ae120d324d23f25486dc6f;p=netatalk.git added script to shorten names --- diff --git a/contrib/shell_utils/Makefile.am b/contrib/shell_utils/Makefile.am index c88e7312..603b9434 100644 --- a/contrib/shell_utils/Makefile.am +++ b/contrib/shell_utils/Makefile.am @@ -10,6 +10,7 @@ SUFFIXES = .tmpl . CLEANFILES = lp2pap.sh -bin_SCRIPTS = apple_cp apple_mv apple_rm cleanappledouble.pl lp2pap.sh +bin_SCRIPTS = apple_cp apple_mv apple_rm cleanappledouble.pl lp2pap.sh \ + netatalkshorternamelinks.pl EXTRA_DIST = $(bin_SCRIPTS) diff --git a/contrib/shell_utils/netatalkshorternamelinks.pl b/contrib/shell_utils/netatalkshorternamelinks.pl new file mode 100755 index 00000000..957a817a --- /dev/null +++ b/contrib/shell_utils/netatalkshorternamelinks.pl @@ -0,0 +1,36 @@ +#!/usr/bin/perl +# +# (c) 2000 Christian Wolff, scarabaeus@scarabaeus.org +# quick hack to create symbolic links for files with names over 31 chars long +# + +$searchpath='/data/mp3/'; +$destpath='/data/mac_mp3/'; + +# only if you dare! +`rm -rf ${destpath}*`; +foreach $f (`find $searchpath -name '*.mp3'`) { + chomp $f; + $f=~s/^$searchpath//; + if ($f=~/^(.*)\/(.*)$/) { + ($path,$file)=($1,$2); + } else { + ($path,$file)=('',$f); + } + $shortpath=''; + for $splitpath (split /\//,$path) { + if (length $splitpath > 31) { + # keep the last 2 chars of the directory name + $splitpath=substr($splitpath,0,29).substr($splitpath,-2,2); + } + $shortpath.="${splitpath}/"; + mkdir $destpath.$shortpath,0755; + } + $shortfile=$file; + if (length $file > 31) { + # keep the extension of 4 chars + $shortfile=substr($file,0,27).substr($file,-4,4); + } + `ln -sf ${searchpath}${f} ${destpath}${shortpath}${shortfile}`; +} +