How to Unzip files on a Linux Server

Here is my small php script for unzipping zipped files on a Linux server.

I looked all over the Internet for such a script and could not find one that met my needs needed something small, so I decided to write my own.  You can download it at the bottom of this page for free and use it at your own risk.

I host with godaddy and they don't provide any "out of the box" tools to unzip zipped files (they have recently added a file manager in their hosting control panel, but you still need to log in etc in order to unzip files) - therefore the creation of the unzipper.php script.



unzipper.php

PHP script for unzipping zipped files in Linux hosting environment
Scripted by Cobus C H Taljaard (cobus DOT taljaard AT gmail DOT com)
Free to use and change as you see fit. No guarantee provided. Use at own risk!
I've tested it on godaddy.com Linux hosting.

Why:
When you need to FTP a large amount of files in one sitting, it takes a lot of time.  It is MUCH quicker to FTP a zipped file and then to extract the contents (with directory structure) on the server itself. Something that took me over ten minutes now barely takesone!

Instructions:
  • FTP the "unzipper.php" and "pclzip.lib.php" files to your online folder containing the zipped file/s and run it from your browser
  • This script only looks for zipped files in the same folder as where the script is run from!
  • NB NB NB - this script overwrites all files without asking. Please make sure you are using the correct directory. I advise you to first test it with a small zip file containing one dummy text file.

Example:
  • Let's say you have zipped files stored in the domain.com/zips folder that you want to unzip
  • Then you need to FTP "unzipper.php" and "pclzip.lib.php" to the same "zips" directory of domain.com
  • Now access "http://www.domain.com/zips/unzipper.php" from your browser and follow the onscreen instructions

Here is the download link: unzipper.zip

0 comments:

Post a Comment

 
Top