Blame Scripts/Bash/centos-art/Styles/renameFile.sh
|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# renameFiles.sh -- Rename files names, inside svn repository,
|
|
|
4c79b5 |
# massively.
|
|
|
4c79b5 |
#
|
|
|
72c8a5 |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is free software; you can redistribute it and/or
|
|
|
4c79b5 |
# modify it under the terms of the GNU General Public License as
|
|
|
4c79b5 |
# published by the Free Software Foundation; either version 2 of the
|
|
|
4c79b5 |
# License, or (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is distributed in the hope that it will be useful, but
|
|
|
4c79b5 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c79b5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# You should have received a copy of the GNU General Public License
|
|
|
4c79b5 |
# along with this program; if not, write to the Free Software
|
|
|
4c79b5 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
4c79b5 |
# USA.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
# $Id: renameFile.sh 12 2010-09-10 09:55:08Z al $
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if [ ! $# = 4 ];then
|
|
|
4c79b5 |
cli_printMessage "`gettext "Syntax: ./update-filenames.sh <PATH> <FILTER> <PATTERN> <VALUE>"`"
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
ROOTDIR="$1"
|
|
|
4c79b5 |
FILTER="$2"
|
|
|
4c79b5 |
PATTERN="$3"
|
|
|
4c79b5 |
VALUE="$4"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
for FILE in `find $ROOTDIR -regex $FILTER`;do
|
|
|
4c79b5 |
DIR=`dirname $FILE`
|
|
|
4c79b5 |
FILE=`basename $FILE`
|
|
|
4c79b5 |
svn mv $DIR/$FILE $DIR/`echo $FILE | sed -r "s!$PATTERN!$VALUE!"`
|
|
|
4c79b5 |
done
|