Update of /cvsroot/linux-vax/toolchain/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18086
Modified Files:
copy_directory.sh
Log Message:
- Allow to omit certain directories (most notably the metadata directories
used by CVS and SVN, called "CVS" and ".svn".
- Based on Kenn Humborg's patch.
Index: copy_directory.sh
===================================================================
RCS file: /cvsroot/linux-vax/toolchain/scripts/copy_directory.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- copy_directory.sh 28 Dec 2005 18:27:44 -0000 1.3
+++ copy_directory.sh 5 Jan 2006 18:05:49 -0000 1.4
@@ -5,13 +5,20 @@
# $2 - destination directory
#
function copy_directory() {
- echo "Copying ${1} to ${2}"
- (cd "${1}" && tar cpf - .;) | (cd "${2}" && tar xpf -;)
+ EXCLUDE=""
+ echo -n "Copying ${1} to ${2}"
+ if [ $# -eq 3 -a -n "${3}" ]; then
+ EXCLUDE="--exclude=${3}"
+ echo " excluding ${3}"
+ else
+ echo
+ fi
+ (cd "${1}" && _Tar cpf - ${EXCLUDE} .;) | (cd "${2}" && _Tar xpf -;)
}
-if [ $# -ne 2 ]; then
- echo "$0 <src-dir> <dest-dir>" >&2
+if [ $# -ne 2 -a $# -ne 3 ]; then
+ echo "$0 <src-dir> <dest-dir> [<exclude-pattern>]" >&2
exit 1
fi
@@ -24,5 +31,5 @@
exit 1
fi
-copy_directory "${1}" "${2}"
+copy_directory "${@}"
|