#!/usr/bin/perl -- -*- cperl -*- `rm -rf probabilistic/*`; chdir "probabilistic" or die "Cannot change to probabilistic directory: $!\n"; $.='_'; $weight=1; foreach $n (5..10) { $rating = sprintf("%02d", $n); print "*** Items rated $rating:\n"; foreach (<../$n/*>) { $target=$_; s/.*\///; # (Greedy match goes to last slash.) ($basedest, $ext) = ($_=~m/(.*)[.]([^.]+)/); foreach $dn (1..$weight) { print "ln -s $target $rating$.$basedest$.x$dn.$ext\n"; `ln -s $target $rating$.$basedest$.x$dn.$ext`; } } $weight+=2; }