source: main/trunk/model-sites-dev/heritage-nz/collect/pdf-reports/STAGING/PROC-REDACT.sh@ 33679

Last change on this file since 33679 was 33679, checked in by davidb, 4 years ago

Folder for working on updates (PDFs to del, PDFs to add) from Kiri

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/bin/bash
2
3
4argc=$#
5
6if [ $argc != "1" ] ; then
7 echo "******" >&2
8 echo " Usage: $0 yyyy-mm-dd" >&2
9 echo "******" >&2
10 exit
11fi
12
13
14batch=${1%/}
15pdf_del_dir="$batch/Pdfs-To-Delete"
16
17
18if [ ! -d $pdf_del_dir ] ; then
19 echo "******" >&2
20 echo "Failed to find $pdf_del_dir" >&2
21 echo "******" >&2
22 exit
23fi
24
25
26echo "Processing PDFS in $batch"
27
28procdate=`date`
29echo "$procdate: Processing PDFS in batch directory $batch" >> NOT-REDACTED.log
30
31for f in $pdf_del_dir/*.pdf ; do
32 localf=${f##*/}
33# echo "Looking for: $localf"
34
35 lines=$(find IMPORT/ -name "$localf" -print | wc -l)
36
37 if [ $lines -eq 0 ]; then
38 # Look to see if it is in the REDACTED/batch area
39 # If it is, then it *did* exist, and in fact we have already processed it!
40 # => no need to print out warning in that case
41 lines=$(find REDACTED/$batch -name "$localf" -print | wc -l)
42 if [ $lines -eq 0 ] ; then
43 echo " Failed to find: $localf" >&2
44 echo "$localf" >> NOT-REDACTED.log
45 fi
46
47 else
48 match=$(find IMPORT/ -name "$localf" -print)
49 echo "Moving \"$match\" -> \"REDACTED/$batch/.\""
50 mv "$match" "REDACTED/$batch/."
51 fi
52done
53
54echo ""
55echo "Logged failed to find message(s) to:"
56echo " NOT-REDACTED.log"
57echo ""
58
59
Note: See TracBrowser for help on using the repository browser.