#!/bin/sh # # MASS RENAME V 1.2 # (c) 2000 Giancarlo Erra # This software is under the GNU Public License (GPL) # # # This script is launched by mrename with all necessary parameters # Do not launch this script manually. # # Variables: $2= $nnumber= $mfile= # # this is the most untested and buggy string... mfile=$(echo $1 | sed 's/...//') if [ $3 == "copy" ] then number=$(cat ./.mrename-c) nnumber=$[$number+1] echo "$nnumber" > ./.mrename-c # This command rename with format # copying files (that is using cp command) cp $mfile $2$nnumber$mfile # If you want to rename with format # uncomment the line below # # cp $mfile $nnumber$2$mfile # # and comment the previous "cp $mfile $2$nnumber$mfile" elif [ $3 == "move" ] then number=$(cat ./.mrename-c) nnumber=$[$number+1] echo "$nnumber" > ./.mrename-c # This command rename with format # moving files (that is using mv command) mv $mfile $2$nnumber$mfile # If you want to rename with format # uncomment the line below # # mv $mfile $nnumber$2$mfile # # and comment the previous "mv $mfile $2$nnumber$mfile" fi # THE END ;)