Friday, January 11, 2008

renaming files using shell

This script can be used to change the case of a file as required on the server
Its simple concept
find the exising files
change their case
move the old to new name

[root@server files]# vi rename.sh
#!/usr/bin/sh

c=`find . -name 'Course.xml' `;#|sed "s/Course/course/";
for path in ${c[@]}
do
newname=`echo $path|sed "s/Course/course/"`;
echo $newname;
mv $path $newname

done;

No comments: