Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    Aug 2005
    Posts
    1,119
    Thanks
    2
    Thanked 1 Time in 1 Post

    recursive file saving/zipping

    Heres what I want to do. I want to have a script that I can put the file in a path, and for every folder/file beneath it in the directory structure, it will keep the structure, copy it to a zip file/tar.gz/rar or whatever and email it as an attachment.

    Say the script is in my server root.

    script.php
    folder1/
    folder1/index.php
    folder1/images/
    folder1/images/logo.jpg
    folder1/images/header.gif
    folder2/files/super.zip
    folder9/some/etc.txt

    script.php would keep the file structure for everything beneath it and compress it and email it. I have been trying to find something like this online, but have been having trouble. this is pretty much just for a backup cron job that I can run once a week. Any ideas?

  • #2
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Just use any compressing command? Most if not all retain directory structure.

  • #3
    Senior Coder
    Join Date
    Aug 2005
    Posts
    1,119
    Thanks
    2
    Thanked 1 Time in 1 Post
    what compression system is default to php5. It appears that zip needs an extra library, and additional setup. Which compression method would I be able to assume works on most if not all hosts?

  • #4
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ziplib... I think? And it is an extra library. I had to have this installed on a clients server as it didn't come standard on his dedicated. But if you are on a shared host, it 'should' already be installed.

    EDIT: Theres also gzip? Man I don't use compression to often, but I think that one compresses your page though? LOL I feel stupid right now.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •