implemented findAndCopy
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Wed, 22 Oct 2003 18:19:14 +0000 (18:19 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Wed, 22 Oct 2003 18:19:14 +0000 (18:19 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@277 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/scripts/functions

index 556da5f..f9215f7 100644 (file)
@@ -50,6 +50,19 @@ function findDir
     findObject -d "$@"
 }
 
+function findAndCopy
+{
+    local dst=$1
+    test ! -s "$dst"         || return 0
+    
+    local tmp
+    shift
+    findFile tmp "$@"
+
+    test "$tmp" -a -s "$tmp" || return 0
+    cp -af "$tmp" "$dst"
+}
+
 function getPhysicalDir
 {
     ( set -P && cd "$1" && pwd )