Page 1 of 1

file types using bash unzip

PostPosted: Sat Aug 13, 2016 12:07 pm
by dotsandlines
I'm trying to make a workflow that automatically extracts image files out of .docx files, which are essentially .zip files. I've almost got it working... But I find that in Hazel, my script will only extract file extensions .png and .jpeg, and won't do .jpg (or, as I discovered while troubleshooting, .xml). Unzip grabs all file types when run through Terminal.

FILENAME="$1"
MYPATH=$(dirname "$FILENAME")
unzip -j "$1" *{.png,.jpeg,.jpg} -d "$MYPATH"

Fallback is to try an external shell script, but I thought I'd ask here first.

Re: file types using bash unzip

PostPosted: Mon Aug 15, 2016 11:12 am
by Mr_Noodle
Turn on debug mode (see sticky article) which will show any output from the script. If there are no errors showing there you may need to add output statements to your script.