![]() |
|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
![]() |
|
Thread Tools | Display Modes |
|
||||
![]() Quote:
I want only send 4 GB packages in one folder , it is not important which package go to which DVD. |
|
|||
![]()
This is a wonderful opportunity for you to write such a script yourself. You can customize it to meet your exact needs.
As I suspect you don't know shell programming now, a good tutorial can be found at the following: http://steve-parker.org/sh/bourne.shtml |
|
||||
![]()
If you are looking to minimize space wastage on the dvd, then this is a bin packing problem: http://en.wikipedia.org/wiki/Bin_packing_problem
If you want something simple perhaps you try something like this: 1. Sort the rpm files in decreasing order by size. 2. Create 18GB/4GB = 5 bins (directories). 3. Pick one item off the top of the sorted list & put it into the first bin where it can fit. 4. Repeat step 3 until the list is empty. Give it a try & don't forget to show us your script when its done. :-) Of course, if you have any problems while writing the script you can always ask. Last edited by ephemera; 15th April 2010 at 10:27 PM. |
|
||||
![]()
Ok, try this:
Code:
#!/bin/sh # # Binpack using first fit decreasing strategy # -ephemera binsz=4200000 # in KB nbins=1 b1=0 mkdir bin1 echo Processing files, please wait... find . -type f | xargs du | sort -rn | cut -f2 | while read f do n=1 while true do eval s=\$b$n z=$(du $f | cut -f1) m=$(($s + $z)) if [ $m -le $binsz ]; then echo $(basename $f) "->" $n eval mv $f bin${n} eval b${n}=\${m} break fi n=$(($n + 1)) if [ $n -gt $nbins ]; then eval mkdir bin${n} nbins=$n eval b${n}=0 fi done done Once the script is done run 'ls' & see if it worked. Last edited by ephemera; 15th April 2010 at 10:29 PM. |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
packages vs ports | zelut | FreeBSD Ports and Packages | 17 | 28th October 2009 08:19 AM |
Can't Add Packages due to intl.4.0 | jrs665 | OpenBSD Packages and Ports | 4 | 20th October 2008 10:44 AM |
Packages vs. Ports | guitarscn | OpenBSD Packages and Ports | 3 | 1st October 2008 04:43 AM |
Where have all the packages gone? | PatrickBaer | FreeBSD Ports and Packages | 6 | 12th June 2008 11:03 PM |
Sorting Packages | JMJ_coder | NetBSD Package System (pkgsrc) | 3 | 20th May 2008 01:08 AM |