On 11/8/05, Carl Lowenstein <[EMAIL PROTECTED]> wrote:
> On 11/8/05, Dave <[EMAIL PROTECTED]> wrote:
> > Um, I guess I should rephrase my question.
> >
> > There are scripts that you specify the size limit of a CD, it will
> > back all your data but stop at that size limit and create an ISO or
> > burn straight to a CD, then get more files to put in a new ISO.
> > Instead I would like the files put in a directory instead of in an
> > ISO.
>
> That is in fact the way that Chris Johnson's script works. It creates
> enough directories to hold all the files, distributing the files so as
> to fill each directory as close to the specified size as it can.
>
> < http://www.apress.com/book/download.html >
> Select "Shell Scripting Recipes" and click <submit>. You will get to
> a page where you can download a tar.gz file containing all the scripts
> from the book. Read the script, read the book, ... There are
> something like 128 scripts, an installation script, and a README file.
>
> The bin-pack script is 108 lines long, you can get it for yourself.
Looking carefully at "bin-pack" I found that there is a function
"dir_size" missing. E-mail correspondence with the author verified
this, and I got a fix for it. One modifies the script
"standard-funcs", which is sourced by various other scripts. Here is
the fix:
diff -c -r1.1 standard-funcs-sh
*** standard-funcs-sh 2005/11/09 21:05:05 1.1
--- standard-funcs-sh 2005/11/09 21:05:51
***************
*** 333,335 ****
--- 333,345 ----
}
trap cleanup EXIT ## Set trap to call cleanup on exit
+ dir_size() ## calculate total size of files in directory/ies
+ {
+ for ds_dir
+ do
+ ls -l ${ds_dir:+${ds_dir%/}/} |
+ grep -v '^d' |
+ awk 'BEGIN {OFMT = "%d" } {total += $5} END { print total }'
+ done
+ }
+
Also, read the code carefully -- it might not do what you really want.
It is destructive of the original data, "mv"ing it into newly created
directories, and splitting files that are too large to fit on a single
output disk.
Also be aware that there is some overhead in creating ISO9660 images,
so the 4700MB nominal size of a DVD will not hold 4700,000,000 bytes
of files.
carl
--
carl lowenstein marine physical lab u.c. san diego
[EMAIL PROTECTED]
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-newbie