software to record cd/dvd depending on the size of a folder

Corey Bettenhausen corey at 31415926535.com
Tue Apr 1 13:58:09 UTC 2008


Luca Ferrari wrote:
> Hi all,
> I don't know if there's a software to do this: I'd like to monitor one (or 
> more) folders on a disk, and to make a backup copy on a dvd once the size of 
> the folder has reached an appropriate value (~4GB), removing then the 
> recorded files. Any suggestion?
You can write a shell script and run it periodically via cron.  For 
instance:
#!/bin/sh
MAX_SIZE=4096000
DIR_SIZE=`du -s "$DIR" | awk '{print $1}'`
if [ "$DIR_SIZE" -gt "$MAX_SIZE" ]
then
	<SOME COMMAND TO BURN DVD>
	rm -rf $DIR/*
fi


You'll have to figure out the commands necessary to burn the DVD. I 
don't know that off the top of my head.  But that should get you started.
-Corey




More information about the ubuntu-users mailing list