All pastes #3794338 Raw Edit

ZipGet Diagnostics

public unlisted text v1 · immutable
#3794338 ·published 2017-04-12 01:25 UTC
rendered paste body
#!/bin/bash
#    A script for extracting Microsoft Word Documents from zips in a directory.

#    Copyright (C) 2017, Trisquel Fora user Soon.to.be.Free
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.

#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    If you are using GNU/Linux, you should have received a copy of the GNU General Public License
#    along with your operating system.  If not, or if you are using a different operating system,
#    see <http://www.gnu.org/licenses/>.

if [ -d "$HOME"/Downloads/DocsFound ]; then
	rm -R $HOME/Downloads/DocsFound
fi
mkdir "$HOME"/Downloads/DocsFound

find . -name "*.zip" -type f -print | while read WS_FILE;
do
	echo
	echo
	echo "Handling Archive ${WS_FILE}..."
	echo
	echo
	WS_DIREXT="$HOME"/Downloads/DocsFound/`basename "$WS_FILE"`
	mkdir "$WS_DIREXT"
	
	unzip "$WS_FILE" "*.doc" -d "$WS_DIREXT"
	unzip "$WS_FILE" "*.docx" -d "$WS_DIREXT"
	rmdir "$WS_DIREXT" 2&> /dev/null
done