From 33d7d0ca2a00ab3fff46856b5f5f28e3b5c9ea54 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Sat, 8 Aug 2020 22:11:27 +0100 Subject: [PATCH] improve nested file and directory support for copyfromcontainer --- compose/bin/copyfromcontainer | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compose/bin/copyfromcontainer b/compose/bin/copyfromcontainer index bf08dcb2b..485f6c6d4 100755 --- a/compose/bin/copyfromcontainer +++ b/compose/bin/copyfromcontainer @@ -6,6 +6,10 @@ if [ "$1" == "--all" ]; then docker cp $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/./ $REAL_SRC/ echo "Completed copying all files from container to host" else - docker cp $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/$1 $REAL_SRC/ + if [ -f "$1" ] ; then + docker cp $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/$1 $REAL_SRC/$1 + else + docker cp $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/$1 $REAL_SRC/$(dirname $1) + fi echo "Completed copying $1 from container to host" fi