Here's a simple program to convert zip files to tarballs........To keep it simple, this will only create a single tarball, and using wildcards in the zip filename is not supported.........To do multiple archives, you'll need to run it through a loop......
Output can also be piped to another program, such as gzip or bzip2, by omitting the name of the tar file or using '-' in place of the tarball name.....
Code:
#! /bin/bash
##
## zip2tar: Convert a zip file to a tar file
##
readonly PROG="${0##*/}"
## Change to suit. ('/var/tmp/tmpfs' is a tmpfs mounted dir on my machine):
TDIR="/var/tmp/tmpfs/${PROG}"
## Cleanup on exit:
trap "rm -rf '${TDIR}'" EXIT
## Assign args:
test -z "${1}" &&
{ echo -e "\tUsage: ${PROG} filename.zip [filename.tar]"; exit 1;}
ZIP="${1}"
TAR="${2}"
## If no tar file named, we'll assume STDOUT:
test -z "${TAR}" && TAR="-"
## Set up clean temp dir:
rm -rf "${TDIR}"
mkdir -p "${TDIR}"
## Unzip to temp dir, then tarball the contents (only) of the temp dir
## to named tar file (or STDOUT if no tar file was specified):
unzip -qq "${ZIP}" -d "${TDIR}" || exit $?
## List files in directory order (unsorted), not alphabetical order, to speed
## things up a bit:
LIST="$(ls -UA "${TDIR}")" || exit $?
test -z "${LIST}" &&
{ echo -e "${PROG}: No files or directories found for tarring"; exit 1;}
tar cCf "${TDIR}" "${TAR}" ${LIST}
exit 0
NOTE: To help speed things up a bit, point the temp directory (TDIR) to a tmpfs mounted directory........Just make sure you have enough space allocated for large archives...
---thegeekster