NArc0t1c Posted August 28, 2007 Share Posted August 28, 2007 Hey.. I'm trying to make something for someone, this requires the server, using a crontab to make a backup of all the files, and maybe also the mysql database. I thought I will use Zip to archive the files/dictionaries, and then upload it to another remote ftp server. I have the Ftp working, it makes connection and sends files. But here comes my problem, how can I zip the files, and the dictionaries? It would require a check to see if it is a dir, if it is, then loop trough that dir and upload those files. How can I achieve this? Here is a script I tried to make to just upload the files via Ftp, This is creating dictionaries and the root files, btu not uploading the files within the sub folders. <?php $FtpServer = 'server'; $FtpPort = 21; /* Password and user comes here.. */ $FtpDir = '/narc0de/'; $dir = 'c:\wamp\www\ziptest\narc0de'; $Stream = ftp_connect($FtpServer, $FtpPort,60); $Login = ftp_login($Stream, $FtpUser, $FtpPasswd); if (!$Login || !$Stream){ echo 'Login or Connection Failed.'; exit; } if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false ) { echo $file; $i++; if( $file != "." && $file != ".." ) { $nowd = ftp_pwd($Stream); $Do = ftp_put($Stream, $file, $nowd.$file, FTP_BINARY); } } closedir($dh); } } if (isset($Do)){ echo 'Uploaded backup.'.$i; } else { echo 'Upload Failed.'; } ftp_close($Stream); exit; ?> Thanks Ferdi Link to comment https://forums.phpfreaks.com/topic/67089-solved-making-backups/ Share on other sites More sharing options...
NArc0t1c Posted August 28, 2007 Author Share Posted August 28, 2007 *bump* Link to comment https://forums.phpfreaks.com/topic/67089-solved-making-backups/#findComment-336532 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.