]> arthur.barton.de Git - netatalk.git/commitdiff
added script to shorten names
authorrufustfirefly <rufustfirefly>
Mon, 7 May 2001 14:15:42 +0000 (14:15 +0000)
committerrufustfirefly <rufustfirefly>
Mon, 7 May 2001 14:15:42 +0000 (14:15 +0000)
contrib/shell_utils/Makefile.am
contrib/shell_utils/netatalkshorternamelinks.pl [new file with mode: 0755]

index c88e7312cb1dac861c4e03fb364c3629caead4d5..603b94341a8205fd8dcbb24757fced63af53307a 100644 (file)
@@ -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 (executable)
index 0000000..957a817
--- /dev/null
@@ -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}`;
+}
+