[asp.net 1.1] Little util for zipping files on a site.

Discussion in 'ASP.NET Code Snips' started by antic, Dec 13, 2008.

  1. antic

    antic Perch

    This is a little something I cooked up today. Sometimes Webshell is great for zipping up some files if you want to download them. But sometimes you want to zip up a few things, perhaps as a temporary backup, and leave them there on the site. Here's a tool which will do it.

    I used .net 1.1 because it isn't constrained by the medium-trust rule that only allows operation within the application root folder. So, using this app, you can zip up files from any domain or subdomain in your FTP space - same as you can with Webshell.

    The attached zip file contains the following:

    bin/ICSharpCode.SharpZipLib.dll
    bin/zipit11.dll
    zipit11/default.aspx
    zipit11_source/{project source files}
    Web.config


    Installation

    Simply unzip the files into your web root folder.
    Note: You should first delete web.config from the archive if you already have one present on your site that you are using and don't want to overwrite it. You can also delete the zip11_source folder if you don't need the source.

    Running

    Now browse to {yourdomain}/zipit11
    You should now see a form with two fields:

    Under Zip Filename, type the desired name of your archive (zip) file. Do not type the ".zip" extension, just the name you want.

    Under Path to Add type the path you want to zip up. Note that the application looks at your FTP root folder as your root path. So if you want to zip up everything in your "mydomain.com" folder, just type mydomain.com. If you want to zip up everything in your "images" subfolder, type mydomain.com\images. Note use backslash "\" not forwardslash.

    Then click Submit and it will start zipping. The archive will be created in your FTP root folder. That is, at the very top, where you see your domain folders.

    Notes on Archive Paths and Unzipping

    The zip function I'm using does not add the specified folder name to the zip file's root path. Therefore if you decide to zip up your "makeabuck.com" site folder, the resulting zip file will start with "index.html" then move onto "images/mylogo.gif", etc. That is, there will be no "makeabuck.com" root folder in the zip file.

    Similarly, if you want to zip up "makeabuck.com\images" it will not add the "images" folder, it will start will the files there and add the subfolders. Basically this means if you want to unzip it again using Webshell, you first need to move the zip file into your "makeabuck.com" site folder (or whatever folder you chose to zip up), as that's where it will start unzipping your files.

    That's it

    Let me know if you have any questions. I take no responsibility for any loss or damage, premature baldness, etc. resulting from using this code. Project source is included.

    Attached Files:

  2. antic

    antic Perch

    egads, not a single thank-you, after 32 downloads of the file.
    What are forums coming to these days?
    :bsofa:
  3. SubSpace

    SubSpace Bass

    Being a programmer is (usually) a thankless job :( :D
  4. antic

    antic Perch

    True, so true.. :violin:

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services