kebirhost

Active Member
Jan 9, 2005
27
13
153
Hello,

I need to rename many files in a directory recursively. I have a scripts renaming the files but it does not work recursively. The script is below;

###################
# renames.sh
# basic file renamer

criteria=$1
re_match=$2


for i in $( find ./ -name *$criteria* );
do
src=$i
tgt=$(echo $i | sed -e "s/$criteria/$re_match/")
mv $src $tgt
done
######################


If you have this kind of scripts but working recursively, please post here. Thanks for all.

Melih
 

kebirhost

Active Member
Jan 9, 2005
27
13
153
Hi,

Thanks so much but it gives an error as;

find: missing argument to `-exec'

I am not an expert so sorry for any misunderstanding.

Melih