#!/usr/local/bin/bash # Change files extensions from $1 to $2 if [ -z "$2" ] ; then echo Usage: $0 \ \ exit fi ## Add "win" extension to few files, which are Windows only. ## They are copied to the Unix area in order to save them in ## the configuration control system mv XmlConvertor.cpp XmlConvertor.cpp-win mv XmlConvertor.h XmlConvertor.h-win mv StdAfx.cpp StdAfx.cpp-win mv StdAfx.h StdAfx.h-win mv resource.h resource.h-win for file in *.$1 ; do cmd="echo $file | sed -e 's/\.$1\$//'" dest=`sh -c "$cmd"` if [ -e "$dest.$2" ]; then echo Cowardly refusing to overwrite $dest.$2 continue fi echo $file \>\> "$dest.$2" /bin/mv -f $file "$dest.$2" done ## Convert source files to Unix format for file in *.[Ch] ; do dos2unix $file >$file-ux cp -f $file-ux $file rm -f $file-ux done