#!/bin/sh # renext - Mass File Rename # Copyright (c) 2006-2008, TundraWare Inc., Des Plaines, IL USA # All Rights Reserved. Non-Commercial Use Hereby Permitted. RCSID="$Id: ren,v 0.102 2008/03/22 18:16:05 root 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 *$1* 2>/dev/null` do tgt=`echo $f | sed s/${1}/${2}/g` if [ $f != $tgt ] then mv ${arg} $f $tgt fi done fi