Re: Split files
| From: | DL Neil | Date: | Thu, 24 Jan 2002 12:46:40 +0000 |
| Subject: | Re: Split files | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-81868@lists.php.net to get a copy of this message | ||
> > > Making any sense?
> >
> > Year, so I have to do it manually (thought someone could preveting me from
> > reinvent the wheel... ;-)
> >
> > > What are you really trying to achieve?
> >
> > I'm trying to split a large binary file (>2 GB) into peaces of 700 MB to
> > burn it on a cd. It's a part of a backup-mechanism I'm wirting in PHP.
>
> Maybe you could find a program that will do the split for you then call that
> from within PHP.
=Hmm, I'm still come at it from the other way around (all due respect to Jason) - but then I
don't recall OpSys
details, or know if there is a utility/tool for the job in your choice of OpSys.
=What it reminds me of, is what we used to do when archiving files/file sets larger than 1.44MB -
zipping them
onto more than one diskette.
=Try using PHP to read the original file, and copy it out into a set of ~700MB copy/sub-files. Burn
each of
these onto CDs. Get PHP to output a handy 'key' - report listing what came from where and
how to reassemble it
all again (in six months' time when all is forgotten).
open original file
$FileCtr=0;
while not eof
{
create output sub-file nr $FileCtr
$MegCtr=1;
while $MegCtr<700 and not eof
{
read megabyte
write to sub-file
$MegCtr++;
} //end write loop
close sub-file
$FileCtr++;
} //end read
close original file
echo "Copied original into $FileCtr sub-files";
=Regards,
=dn