...

View Full Version : recursive file saving/zipping



thesavior
04-04-2007, 06: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
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?

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

thesavior
04-04-2007, 04: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?

iLLin
04-04-2007, 04: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