Only output file download error text when logging is turned up.
[clinton/thingy_grabber.git] / thingy_compress.sh
1 #!/bin/sh
2 sourcefile=${1%/}
3
4 if [ ! -d "$sourcefile" ]
5 then
6 echo "$1 does not appear to be a directory."
7 exit 1
8 fi
9
10 timestamp=$(echo $(cat "$sourcefile/timestamp.txt") | sed 's/:/./g')
11
12 if [ -z "$timestamp" ]
13 then
14 echo "No timestamp?"
15 exit 1
16 fi
17
18 output="${sourcefile} - ${timestamp}.7z"
19
20 if [ -f "${output}" ]
21 then
22 echo "Target file ${output} already exists"
23 exit 1
24 fi
25
26 7z a -mx=9 "${output}" "${sourcefile}"