Skip to content

Instantly share code, notes, and snippets.

@SheetJSDev
Created August 15, 2021 19:36
Show Gist options
  • Save SheetJSDev/3468d93b7974fb57b48635e6777afde6 to your computer and use it in GitHub Desktop.
Save SheetJSDev/3468d93b7974fb57b48635e6777afde6 to your computer and use it in GitHub Desktop.
#!/bin/bash
OUTPATH=${1:-/tmp/out/}
doit() {
echo "$1" "$2"
hcopy -r "$1:*" "$2" 2>&1 >/dev/null | sed 's/hcopy: "//g; s/": is a directory//g' | while read x; do
NEWPATH="$OUTPATH/${x//://}"
mkdir -p "$NEWPATH"
doit "$x" "$NEWPATH"
done
}
mkdir -p "$OUTPATH"
doit "" "$OUTPATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment