#!/bin/sh # renext - Mass File Rename # Copyright (c) 2006, TundraWare Inc., Des Plaines, IL USA # All Rights Reserved. Non-Commercial Use Hereby Permitted. RCSID="$Id: ren,v 0.101 2006/08/23 21:02:25 toor Exp $" arg="" if [ $1_ = -v_ ] then arg=$1 shift fi if [ $# != 2 ] then echo "usage: ren [-v] oldstring newstring" echo " Renames filenames containing 'oldstring' replacing with 'newstring'" else for f in `ls -a 2>/dev/null` do tgt=`echo $f | sed s/${1}/${2}/` if [ $f != $tgt ] then mv ${arg} $f $tgt fi done fi