Show
Ignore:
Timestamp:
03.11.2016 14:26:13 (3 years ago)
Author:
davidb
Message:

Addition of second argument, optional, for where to save the files

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/hathitrust/wcsa/extracted-features-solr/trunk/solr-ingest/scripts/FULL-DOWNLOAD-EVERY-N.sh

    r31035 r31053  
    11#!/bin/bash 
    22 
    3 if [ "$#" != "1" ] ; then 
    4     echo "Usage FULL-DOWNLOAD-EVERY-N.sh <num>" >&2 
     3argc=$# 
     4 
     5if [ "$argc" != "1" ] && [ "$argc" != "2" ] ; then 
     6    echo "Usage FULL-DOWNLOAD-EVERY-N.sh <num> [output-dir]" >&2 
    57    exit 1 
    68fi 
     
    810num=$1 
    911 
    10 if [ ! -d full-ef-json-files ] ; then 
    11   mkdir full-ef-json-files 
     12if [ "$argc" = "2" ] ; then 
     13  output_dir="$2" 
     14else 
     15  output_dir="full-ef-json-files" 
    1216fi 
    1317 
     18# Remove any trailing /. 
     19output_dir="${output_dir%/\.}" 
     20output_dir="${output_dir%/}" 
     21 
     22if [ ! -d "$output_dir" ] ; then 
     23  echo "" 
     24  echo "****" 
     25  echo "* Creating $output_dir" 
     26  echo "****" 
     27  echo "" 
     28  mkdir "$output_dir" 
     29fi 
     30 
     31# Now ensure a trailing /. is present! 
     32output_dir="${output_dir}/." 
     33 
     34 
    1435rsync -pav --files-from=full-listing-step${num}.txt \ 
    15     data.analytics.hathitrust.org::features/ full-ef-json-files/. 
     36    data.analytics.hathitrust.org::features/ $output_dir