7 $0 -o difference.zip -f from.zip -t to.zip
8 $0 -f from.zip -t to.zip
18 while [ $# -gt 0 ]; do
35 excludes="$excludes $1"
44 [ -n "$from" ] || usage
51 echo >&2 "$type: $source"
59 echo >&2 " * Sorry, can't handle deletion of $source."
64 tempdir=`mktemp -d -t zipdiff.XXXXXX`
68 fromlist="$(zipinfo -1 "$from" | grep -v /\$)"
69 tolist="$(zipinfo -1 "$to" | grep -v /\$)"
73 echo "$fromlist" | while IFS= read -r line; do
74 case "$newline$tolist$newline" in
75 *$newline$line$newline*)
80 for P in $excludes; do
83 found excluded "$line"
90 if ! $isexcluded; then
96 echo "$tolist" | while IFS= read -r line; do
97 case "$newline$fromlist$newline" in
98 *$newline$line$newline*)
102 for P in $excludes; do
105 found excluded "$line"
112 if ! $isexcluded; then
113 unzip -p "$from" "$line" > "$tempdir/v1"
114 unzip -p "$to" "$line" > "$tempdir/v2"
115 if ! diff --brief "$tempdir/v1" "$tempdir/v2" >/dev/null 2>&1; then
116 found changed "$line"
126 for P in $excludes; do
129 found excluded "$line"
136 if ! $isexcluded; then
151 echo "$result" | while IFS= read -r line; do
152 echo >&2 "extracting $line..."
154 mkdir -p "$tempdir/${dline%/*}"
155 unzip -p "$to" "$line" > "$tempdir/$line" # this may create an empty file - don't care, DP handles this as deletion
166 7za a -tzip -mx=9 "$output" .