3 # Will find all the archives in the current directory, extract the nested lua/archive files from them, and
4 # then delete the archives. At least, that's what it's supposed to do. No promises.
6 SOURCE_FOLDER
=LocalInput
9 if [ -e "${TEMP_FOLDER}" ]; then
10 rm -rf "${TEMP_FOLDER}"
13 mkdir
-p "${TEMP_FOLDER}"
18 find "${1}" |
while read FILE
; do
19 if [ "${FILE}" != "${1}" ]; then
27 HASH
=`sha1sum -b "${1}" | sed -e 's/ .*//' -`
30 echo "Error calculating hash for ${DFILENAME}."
37 *\ text
*) mv -f "${1}" "${SOURCE_FOLDER}/${HASH}.lua" ;;
38 Zip\ archive
*) mv -f "${1}" "${SOURCE_FOLDER}/${HASH}.zip" ;;
39 RAR\ archive
*) mv -f "${1}" "${SOURCE_FOLDER}/${HASH}.rar" ;;
40 7-zip\ archive
*) mv -f "${1}" "${SOURCE_FOLDER}/${HASH}.7z" ;;
41 *) echo "Ignoring '${1}'" ; rm "${1}" ;;
47 find "${SOURCE_FOLDER}" |
while read FILENAME
; do
48 if [ "${FILENAME}" == "${SOURCE_FOLDER}" ]; then
52 TYPE
=`file -b "${FILENAME}"`
55 Zip\ archive
*) unzip "${FILENAME}" -d "${TEMP_FOLDER}" ;;
56 RAR\ archive
*) unrar e
"${FILENAME}" "${TEMP_FOLDER}/" ;;
57 7-zip\ archive
*) 7z e
"-o${TEMP_FOLDER}" "${FILENAME}" ;;
62 echo "${FILENAME} is not an archive."
66 echo "Processing ${FILENAME}..."
68 find "${TEMP_FOLDER}" |
while read DFILENAME
; do
69 if [ "${DFILENAME}" != "${TEMP_FOLDER}" ]; then
77 rm -rf "${TEMP_FOLDER}"