From 29467871b082902b0e5f6f01a6a6626e3a87293b Mon Sep 17 00:00:00 2001 From: Davis King Date: Mon, 12 Sep 2016 20:00:37 -0400 Subject: [PATCH] Made this script more robust --- tools/imglab/copy_imglab_dataset | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/imglab/copy_imglab_dataset b/tools/imglab/copy_imglab_dataset index 64c2df797..8b44ed166 100755 --- a/tools/imglab/copy_imglab_dataset +++ b/tools/imglab/copy_imglab_dataset @@ -13,10 +13,10 @@ DEST=$2 -FILES=`imglab --files $XML_FILE | xargs perl -e 'use File::Spec; foreach (@ARGV) {print File::Spec->abs2rel($_) . "\n"}' | sort | uniq` +mkdir -p $DEST -mkdir $DEST -cp -a --parents $FILES $DEST +# Get the list of files we need to copy, then build the cp statements with 1000 files at most in each statement, then tell bash to run them all. +imglab --files $XML_FILE | xargs perl -e 'use File::Spec; foreach (@ARGV) {print File::Spec->abs2rel($_) . "\n"}' | sort | uniq | xargs -L1000 echo | xargs -I{} echo cp -a --parents {} $DEST | bash convert_imglab_paths_to_relative $XML_FILE > $DEST/$(basename $XML_FILE)