On Thu, 25 Mar 2004 22:17, Borut Mrak wrote:
> I'm looking for a program that could detect what kind of medium is inserted
> in a CD/DVD writer. Is it a CD or DVD or is the drive empty. On top of that
> I would like to know if the inserted medium is empty or not, but that is
> not really necessary, because the writing will just fail if the drive is
> not empty.

result=`isoinfo -i /dev/cdrom -d`
retcode=$?

$retcode will be 123 for an empty drive, 1 for a blank cdr, 0 for a cdr with 
an iso file system on it.

You can pipe $result into grep to search for specific strings to get more 
information.

You might need to use result=`cdrecord dev=0,0,0 -msinfo` when you get a 
$retcode of 0. If the cdr is fixated $result will be an empty string, 
otherwise you will get a pair of numbers separated with a comma.

The 0,0,0 and /dev/cdrom need to be values that apply to your system.

HTH
Bob Parker


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to