[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] Scripting backups to cdrom.



And Lo! The Great Prophet " Rob Keeling" uttered these words of wisdom:
>
> Ah, I can follow your logic, but I have no idea how to write said scripts.
>

Something like this gives the basis to start from:

        du -sk * | sort -k2 | mklist.awk

where mklist.awk is a short awk script that looks like:

#!/bin/awk -f
BEGIN {
        ## Change LIMIT to whatever -- this is in kilobytes
        LIMIT=680000

        CDCOUNT=1
        SIZE=0
        print " [at] CDROM" CDCOUNT
}
{
        if (SIZE + $1 > LIMIT) {
                SIZE=0
                CDCOUNT++
                print " [at] CDROM" CDCOUNT
        }
        SIZE += $1
        print "./" $2
}
## End of Awk.

Now the output of this can be passed through to something else to create
the ISOs.

Chris...

-- 
\ Chris Johnson                 \
 \ cej [at] nightwolf.org.uk          \
  \ http://cej.nightwolf.org.uk/  ~-----------------------------------+
   \ Redclaw chat - http://redclaw.org.uk - telnet redclaw.org.uk 2000 \____

___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.