#! /bin/bash # # This script copies all "abconfig*.xml" files and rename them to "abconfig*.template", then copy all the other files without changing their names. # # http://stackoverflow.com/questions/1224766/how-do-i-rename-the-extension-of-a-batch-of-files/1225236#1225236 # http://unix.stackexchange.com/questions/41693/how-to-copy-some-but-not-all-files # http://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html # http://www.linuxjournal.com/content/bash-extended-globbing #
# 1. Copy all XML configuration files. cp ~/project/conf/abconfig*.xml ~/temp/shell/
cd ~/temp/shell/
for files in abconfig*.xml do mv"$files""${files%.xml}.template" done
# 2. Copy configuration files other than the XML configuration files. shopt -s extglob cp ~/project/conf/!(abconfig*.xml) ~/temp/shell/ shopt -u extglob