Created
May 21, 2017 15:05
-
-
Save mcenirm/51b346c87dd57274775d32fc2558d1d2 to your computer and use it in GitHub Desktop.
Prepare the transferred-files log from `snowball cp` for easy comparison to `find . -type f -print`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -u | |
Usage () { cat >&2 <<EOF | |
Usage: $0 < /tmp/snowball-xxx/transferred-files | |
Prepare the transferred-files log from 'snowball cp' | |
for easy comparison to 'find . -type f -print'. | |
(Reads from stdin and writes to stdout.) | |
EOF | |
} | |
if [ $# -gt 0 ] ; then | |
Usage | |
exit 1 | |
fi | |
IFS=, read -a header | |
get_mountpoint_from_header () { | |
while [ $# -gt 0 ] ; do | |
case "$1" in | |
cp|--*) | |
shift | |
;; | |
*) | |
break | |
;; | |
esac | |
done | |
sed -e 's#%2F#/#g' <<<"$1" | |
} | |
mountpoint=$( get_mountpoint_from_header "${header[@]}" ) | |
sed -e "s#^${mountpoint}#.#" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment