Skip to content

Compressing a folder in different formats

License

Notifications You must be signed in to change notification settings

Chak10/Backup-Dirs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backup folders

Compressing a folder and its subfolders in different formats (.zip | .tar.gz | .tar.bz2).

function __construct($dirs, $destination = "backup_site.zip", $comp = 'gz', $index = 9, $memory = false) {}
  1. $dirs (String or Array) => The folder/s you need to backup. (Even more folders)
  2. $destination => Destination folder.
  3. $comp => Compression type. (Usually no need to modify it)
    • Zlib => gz
    • Bzip2 => bz2
    • Zlib => deflate
  4. $index => Compression index. (Usually no need to modify it) Min 0 | Max 9
  5. $memory => ONLY in case of memory problems, set it to true (It's not miraculous).

USE

$from_dir = "../admin";
$to_filepath = "../backup_files.zip"; // or "../backup_files.tar"
$bk = new backup_dirs($from_dir, $to_filepath);
if ($bk->res !== true)
    echo $bk->err;
else
    echo "Done";
$from_dir = array(
    "../admin",
    "../cache",
    "../config"
); //With this method, the .tar extension is not supported.
$to_filepath = "../backup_files.zip";
$bk = new backup_dirs($from_dir, $to_filepath);
if ($bk->res !== true)
    echo $bk->err;
else
    echo "Done";

Required PHP Version > 5.3.0 | PHAR Extension or Zip Extension.

Releases

No releases published

Packages

No packages published

Languages