PHP Classes
elePHPant
Icontem

BinPacker: Pack files without exceeding a given size limit

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2005-01-02 (10 years ago) RSS 2.0 feedStarStarStar 52%Total: 1,491 All time: 2,480 This week: 646Up
Version License Categories  
binpacker 1.0.0GNU General Publi...Algorithms, PHP 5, Files and Folders
Description Author  

The purpose of this class is to copy or move the files to a set of directories, so that the total size of all files in each directory does not exceed a given size limit.

It can can be quite handy in situations where you need to transfer an huge amount of files, which would be a tedious job to perform manually.

This kind of problem is also known as bin packing. Current, this class only solves this problem partially.

Innovation Award  
PHP Programming Innovation award nominee
December 2004
Number 5


Prize: One book of choice by SAMS
When it is necessary to backup a large number files to a type of storage media with a limited size, it may be necessary to use multiple media units to perform a complete backup process.

Since the size of each set of files put in each unit may not fit exactly the media size limit, to avoid splitting a file across multiple units, it may be necessary to redistribute the files to minimize the free space that would be wasted otherwise.

This class implements the bin packing algorithm to perform nearly optimal redistribution of the files that are being copied to target media directories.

Manuel Lemos
Picture of Zafar Iqbal
Name: Zafar Iqbal is available for providing paid consulting. Contact Zafar Iqbal .
Classes: 8 packages by
Country: Greece Greece
Age: 41
All time rank: 2852 in Greece Greece
Week rank: 268 Up1 in Greece Greece Up
Innovation award
Innovation award
Nominee: 2x

Details provided by the author  
Bin Packer Class
================

Description
-----------
	Given a set of directories/files and a bin size,
	copy/move the files to a set of directories so that
	the total size of all files in each directory
	does not exceed the bin size.
	Can be quite handy in situations where you need to transfer
	HUGE amounts of files and are fed up with counting bytes
	and you just wanna drag, drop and burn.

	Something to remember (you may not notice but...)
	If 2 files are the same then only one is transferred.
	If you don't like this feature then copy,paste rename afterwards.

	Tested with PHP 5 on Linux and Windows.

Disclaimer
----------
	This Class does not solve the Bin Packing Problem.
	It just tries for the 22% ;)
	If anyone is interested in the algorithm then get in touch.
	Bed time reading:
	http://www.nist.gov/dads/HTML/binpacking.html
	http://mathworld.wolfram.com/Bin-PackingProblem.html
	And finally - BACKUP YOUR DATA BEFORE USE ;)

2004-12-21	ultrasine@gmail.com

  Files folder image Files  
File Role Description
Plain text file class-bp.php Class Class source
Accessible without login Plain text file readme.txt Doc. Read Me
Accessible without login Plain text file test.php Aux. Test File

 Version Control Unique User Downloads Download Rankings  
 0%Total:1,491All time:2,480
 This week:0This week:646Up
User Ratings User Comments (1)  
 All time
Utility:75%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:75%StarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:52%StarStarStar
Rank:1528
 
Excellent
5 years ago (kishore kumar)
70%StarStarStarStar