1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Is there any way to "live zip" all files on a site.

Discussion in 'Web Design & Development' started by StumpedTechy, Feb 27, 2018.

Thread Status:
Not open for further replies.
Advertisement
  1. StumpedTechy

    StumpedTechy Thread Starter

    Joined:
    Jul 7, 2004
    Messages:
    7,234
    Okay I have an issue. I have a website that has a ton of files that get downloaded VERY frequently. Once a month (or longer if I forget) I zip up the files into specific resolutions for people to download the entire zip. What I would like to do is have a way for a person to click on a link and have it "live zip" all CURRENT files on the site in any of the subfolders on the site. Is there any way to do this?

    Example - This is not the content but just an example using file names and pathing to see what I am trying to accomplish.

    Home.com has a number of links to Home.com\zips\1.zip Home.com\zips\2.zip Home.com\zips\3.zip and so on.
    All of the zips are all from files on the site such as 1.zip is from Home.com\pictures\picture1640x480.bmp and Home.com\pictures1\picture2640x480.bmp and Home.com\pictures3\picture3640x480.bmp
    2.zip is Home.com\pictures\picture1800x600.bmp and Home.com\pictures1\picture2800x600.bmp and Home.com\pictures3\picture1800x600.bmp

    I figure instead of rerunning a zip script every month to create new zip file to replace the current 1.zip 2.zip and so on as I place a new file on there have some way the link does some kind of "live archive" and then downloads them all. This would eliminate my monthly activity and keep it always updated no matter if 1 new file is out there or 80 new files.
     
  2. JiminSA

    JiminSA

    Joined:
    Dec 15, 2011
    Messages:
    3,219
  3. JiminSA

    JiminSA

    Joined:
    Dec 15, 2011
    Messages:
    3,219
    Having thought some more, you may get better guidance from this SO thread, which shows you how to code a zip routine (in PHP).
    In essence, you would have the link on which your user clicks, perform a zip of selected directories and then download them;)
     
  4. JiminSA

    JiminSA

    Joined:
    Dec 15, 2011
    Messages:
    3,219
    or more clearly ...
    "and then download the newly created zip file"
     
  5. oitconz

    oitconz

    Joined:
    Feb 21, 2018
    Messages:
    33
    That's a lot of over head on your web server - both cpu (zip deflation and compression calcs) and disk reads (all files ) which will get worse over time.

    Alternative one: what is a better option is to set up a scheduled task to run every x minutes, checking for new files whose datetimestamp is greater than lastCheckedDateTime and add them to the zip rather than creating the zip on the fly every time.

    Modern OS / file systems run a semi database type index so it isn't as if it has to scan all folder manually - it should be quite efficient doing it that way.

    Alternative two: When user clicks on link, scan for files created after lastUpdateDateTime Stamp, add them to the archive and hand it to the user. The check is not triggered on a schedule but on demand by a user.

    Both options avoid all the overhead of newly creating zip, compressing files and updating. 7Zip, linux zip and tar variants all support Update options.
     
    JiminSA likes this.
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1205818

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice