mrename-1.2/ 40755 764 144 0 7066163136 11537 5ustar linux1usersmrename-1.2/mcpmv100755 764 144 2352 7066162364 12710 0ustar linux1users#!/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 ;) mrename-1.2/README100644 764 144 3353 7066161334 12516 0ustar linux1usersMASS RENAME v 1.2 (c) 2000 Giancarlo Erra This software is under the GNU Public License (GPL) INSTALL: -------- Change to root if necessary, copy the two files mrename and mcpmv to your local bin directory (generally /usr/local/bin/), make them +x (chmod +x) and chown/chgrp to your user/group (if you want so). Make sure to have your local bin directory in your PATH. That's all! USAGE: ------ mrename 'pattern' prefix -c|-p - 'pattern' is the pattern to search files to rename (quoted to avoid that bash resolve it) - prefix is the prefix that will be added to the name of each file - The option -c will copy each file with the new filename (cp oldnamed-file newnamed-file) - The option -m will move each file in the new filename (mv oldnamed-file newnamed-file) NOTE: 1) All parameters are needed 2) You have to stay and launch the script in the same directory of the images. The program should be able to write in this directory. Example: If you have a directory with two jpeg images prof.jpg and forp.jpg and you want to add them a prefix like item0, item1 etc.. (that is item0prof.jpg, item1forp.jpg etc..) do this: cd /path/to/the/images mrename '*.jpg' item -c to copy each matching file into another with the new name mrename '*.jpg' item -m to rename each file without keeping a copy with the previous name - Note about the format of rename: The default format is To change this please open the mcpmv file and edit to fit your needs (you will find also an example) For help/bugs/comments: Giancarlo Erra http://alfalinux.sourceforge.net mrename-1.2/mrename100755 764 144 5452 7066162367 13221 0ustar linux1users#!/bin/sh # # MASS RENAME V 1.2 # (c) 2000 Giancarlo Erra # This software is under the GNU Public License (GPL) # # # syntax: mrename '' -c|-m # # help: mrename -h # # ToDo list: # 1) add support # 2) regexp pattern matching # 3) usage outside the current directory # # it looks ugly ... it's ugly... if [ $1 == "-h" ] 2> /dev/null then more << EOF MASS RENAME v 1.2 (c) 2000 Giancarlo Erra This software is under the GNU Public License (GPL) Usage: ------ mrename 'pattern' prefix -c|-p - 'pattern' is the pattern to search files to rename (quoted to avoid that bash resolve it) - prefix is the prefix that will be added to the name of each file - The option -c will copy each file with the new filename (cp oldnamed-file newnamed-file) - The option -m will move each file in the new filename (mv oldnamed-file newnamed-file) NOTE: 1) All parameters are needed 2) You have to stay and launch the script in the same directory of the images. The program should be able to write in this directory. Example: If you have a directory with two jpeg images prof.jpg and forp.jpg and you want to add them a prefix like item0, item1 etc.. (that is item0prof.jpg, item1forp.jpg etc..) do this: cd /path/to/the/images mrename '*.jpg' item -c to copy each matching file into another with the new name mrename '*.jpg' item -m to rename each file without keeping a copy with the previous name -Note about the format of rename: The default format is To change this please open the mcpmv file and edit to fit your needs (you will find also an example) Giancarlo Erra http://alfalinux.sourceforge.net EOF exit else 2> /dev/null echo "" 2> /dev/null fi # just a primitive error check... if [ ! $3 ] then echo "" echo "Syntax error: Please type mrename -h for help" echo "" exit elif [ $3 == "-c" ] then action="copy" elif [ $3 == "-m" ] then action="move" else echo "" echo "Error, wrong third parameter! Should be -m or -c" echo "You inserted < $3 > " echo "Please type mrename -h for help" echo "" exit fi # welcome and enjoy! echo "" echo "MASS RENAME" echo "" echo "I'll do a < $action > action" echo "I'm searching for < $1 > renaming with < $2 > prefix..." echo -n "Please check this parameters and type \"yes\" if correct: " read reply if [ $reply == "yes" ] then echo "0" > ./.mrename-c echo "" find ./ -name "$1" -exec mcpmv {} $2 $action \; echo "" ls --color echo "" rm -rf ./.mrename-c echo "Done" echo "" else echo "" echo "You didn't type \"yes\", exiting..." echo "Please type mrename -h for help." echo "" exit 1 fi # that's all