#!/bin/bash
#
# (c) 2013 Timothy Pearson
# All Rights Reserved
#
# Use like this:
# find ./ -type d -exec /rename_other_files {} \;

cd $1

BASEDIR=${PWD##*/}

if [[ "$BASEDIR" == ".git" ]]; then
        echo "Ignoring .git directory"
        exit 0
fi

ls -d * | sed 's/\(.*\)qm2ts\(.*\)$/git mv "&" "\1tqm2ts\2"/' | grep mv | sh
ls -d * | sed 's/\(.*\)mergetr\(.*\)$/git mv "&" "\1tqtmergetr\2"/' | grep mv | sh
ls -d * | sed 's/\(.*\)msg2qm\(.*\)$/git mv "&" "\1msg2tqm\2"/' | grep mv | sh
ls -d * | sed 's/\(.*\)makeqpf\(.*\)$/git mv "&" "\1maketqpf\2"/' | grep mv | sh
ls -d * | sed 's/\(.*\)qvfb\(.*\)$/git mv "&" "\1tqvfb\2"/' | grep mv | sh
ls -d * | sed 's/\(.*\)createcw\(.*\)$/git mv "&" "\1tqtcreatecw\2"/' | grep mv | sh
ls -d * | sed 's/\(.*\)conv2ui\(.*\)$/git mv "&" "\1tqtconv2ui\2"/' | grep mv | sh

ls -d * | sed 's/\(.*\)findtr\(.*\)$/git mv "&" "\1tqtfindtr\2"/' | grep mv | sh
ls -d * | sed 's/\(.*\)qtrename140\(.*\)$/git mv "&" "\1tqtrename140\2"/' | grep mv | sh
ls -d * | sed 's/\(.*\)qt20fix\(.*\)$/git mv "&" "\1tqt20fix\2"/' | grep mv | sh

# Clean up unintended renames
ls -d * | sed 's/\(.*\)ttqvfb\(.*\)$/git mv "&" "\1tqvfb\2"/' | grep mv | sh

# Rename little-used libraries
ls -d * | sed 's/\(.*\)libeditor\(.*\)$/git mv "&" "\1libtqteditor\2"/' | grep mv | sh
ls -d * | sed 's/\(.*\)libdesignercore\(.*\)$/git mv "&" "\1libtqtdesignercore\2"/' | grep mv | sh
ls -d * | sed 's/\(.*\)libqassistantclient\(.*\)$/git mv "&" "\1libtqassistantclient\2"/' | grep mv | sh
