#!/bin/bash # altblue 1996? # # cine mai stie ce mai facea si cand trasnaia asta.. # nici nu mai stiu de pe unde naiba am recuperat-o... # prolly face un index cu prostii .. seq () { if [ $# -ne 2 ] then echo "Wrong argument number" echo "Usage : seq " else local lower=$1 upper=$2 output; while [ $lower -le $upper ] do output="$output $lower"; lower=`expr $lower + 1` done echo $output; fi } if [ $# -eq 1 ] ; then dir=$1 type="single" else if [ $# -eq 2 ] ; then low=$1 high=$2 type="multi" else echo "ERROR: Wrong argument number" echo "Usage: index [ ]|[dir]" exit 1 fi fi if [ "$type" = "single" ] ; then if [ -d $1 ] ; then pwd=`pwd` cd $dir else echo "Cannot find '$dir'" exit 1 fi file="$HOME/tmp/$RANDOM" find . -maxdepth 1 -type f -printf "

%f\n" >>$file mv -f $file index.html cd $pwd else for i in $(seq $low $high); do file="/tmp/index.$RANDOM" if [ -d $i ] ; then cd $i > $file find . -maxdepth 1 -type f -printf "

%f\n" >>$file mv -f $file index.html cd .. else echo "Warning: Cannot find '$i'" fi done fi #Manufactured by AltBlue