Jump to content

making timestamped bzip2 snapshots


overclucker

Recommended Posts

i would like to be able to make a snapshot of my current school work progress, for later reference, right from the student web server. the code below, i adapted to the absolute paths on my home pc. I also am unaware of what indentation method is prefered for small php scripts. i already tested if test.php is viewable on the sws. i'm guessing there is  a better way to bzip a dir in php, words of advice would be much appreciated.

thanks.

 

#!/usr/bin/env php

<?php
    $stamp = date('Y-m-d-H-i');
    $snappieces = array('/home/oc/Documents/PCC-', $stamp, '.bz2');
    $snapname = implode('', $snappieces);

    $snaptarget = fopen('/home/oc/Documents/PCC', 'r');
    $snap = bzopen($snapname, 'w');

    bzwrite($snap, $snaptarget);
    bzclose($snap);
?>

Link to comment
https://forums.phpfreaks.com/topic/144186-making-timestamped-bzip2-snapshots/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.