Forum Moderators: phranque
unzip or gunzip depending what is installed.
I regularily upload zip files and use a cronjob to check for the existance of a file and unzip it.
#######################
#
# unzip_uploadscd /home/myuploads
if test -f ZIP_UPLOADED_FLAG
then
rm ZIP_UPLOADED_FLAG
if test -f ZIPPEDFILE.ZIP
then
unzip -o ZIPPEDFILE.ZIP -d /home/myuploads
cp ZIPPEDFILE.ZIP old/`date +%d%m%y`.zip
fi
fi
cronjob is set to run that file every 10 minutes.
First it checks for the existence of a ZIP_UPLOADED_FLAG file. This is just a dummy file and is FTP'd after the zip file. The reason for doing this is so that the script will only run after the zip file has been uploaded 100%.
Next, if the zipfile exists it is unzipped and overwrites existing files.
Lastly the zip file is copied to an archive dir and the name changed to the datestamp.