View Full Version : recursive file saving/zipping

04-04-2007, 05:35 AM
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 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?

04-04-2007, 03:16 PM
Just use any compressing command? Most if not all retain directory structure.

04-04-2007, 03:29 PM
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?

04-04-2007, 03:39 PM
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.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum