Recursive zipping

Discussion in 'Programming/Scripts' started by amanuensis, Jan 7, 2009.

  1. amanuensis

    amanuensis New Member

    I have a folder on my server named 'EVENTS' and it contains an additional 50 folders 'EVENT1', 'EVENT2', 'EVENTS3' etc, etc. Each of these 50 folders contains within them a varying amount of files and folders also. (So that is the set up).
    I am wondering if it is within the capabilities of a script to zip all folders in the 'EVENTS' folder recursively ('EVENT1', EVENT2 etc) which would of course include all of the folders contained inside the 50 that live in 'EVENTS' folders. Kind of drilling through all folders contained within the 'EVENTS' folder without having to name them all in the script as they will be changing over time.
    If this could be done (I would need a cron to run it once a day) I would need the old zip to be deleted by the new daily zip.
    At all times I would have the folder structure mentioned above in place with a zipped version of every folder next to the actual folder it was a zipped version of.

    So if I was speaking to the script I would say "I want you to go into every folder you find inside the 'events' folder and zip it, but you must leave the original folders that you have zipped in place and drop the zipped version of next to it, I want you then to do this every day and remove the old zip with the new one, I don't have a list of all the folders in the 'EVENTS' folder, so go into it and work your way through".

    How weird is this getting, I am not the best at explaining but I think this is a little more clear.

    Many thanks in advance for your help
  2. falko

    falko Super Moderator ISPConfig Developer

    Do you want one big zip file containing all folders, or do you want one zip file per folder?
  3. amanuensis

    amanuensis New Member

    One zip file per folder
  4. falko

    falko Super Moderator ISPConfig Developer

    That's a little bit complicated. I'd suggest that you read this guide: (and take a look at the examples provided there).

Share This Page