Re: Check CD-R disk status by Dave
Dave
Mon Oct 20 11:44:05 CDT 2003
This will not work for me.
Thanks for suggestion. I saw a similar example in the MS reference but
problem here is that this does not distinguish between Blank and Drive Not
Ready status, which I want to achieve.
"McKirahan" <News@McKirahan.com> wrote in message
news:I7Ukb.601167$cF.265322@rwcrnsc53...
> "Dave" <mNeOdSiaPlAMog@insightbb.com> wrote in message
> news:BGTkb.601121$cF.265087@rwcrnsc53...
> > Hello,
> >
> > Can someone tell me how to check if a blank unformatted CD-R is present
in
> > the drive and if not blank then if there are any files written on it?
> > I tried checking readiness using IsReady and checking presence of any
data
> > by counting files in drive_letter:\ but I have a catch 22 situation:
> > If the disk is blank drive returns NOT READY and if I check for written
> > data, because drive is not ready (for blank disks) script gives me an
> error
> > CANNOT FIND PATH when trying to count files.
> >
> > Basically what I want to do is:
> > Step 1: check if CD drive is ready, i.e. if a CD is physically there
> > regardless of it's status or formatted state
> > Step 2: if the drive is ready, check for presence of any data, even if
the
> > disk is unformatted without returning error because it's unformatted.
> >
> > Or just simply check if the drive definately contains unformatted and
> blank,
> > out of the box CD-R - just this will suffice if this is possible.
> >
> > Thanks you,
> >
> > Dave
>
> Will this script help?
>
> Option Explicit
> Const cDRV = "E"
> '*
> '* Constant Value Description
> '* --------------------------------------------------------------
> '* Unknown 0 Drive type can't be determined.
> '* Removable 1 Drive has removable media.
> '* Fixed 2 Drive has fixed (nonremovable) media.
> '* Remote 3 Network drives.
> '* CDROM 4 Drive is a CD-ROM.
> '* RAMDisk 5 Drive is a block of Random Access Memory (RAM).
> '*
> Dim arrDRV(5)
> arrDRV(0) = "Unknown"
> arrDRV(1) = "Removable"
> arrDRV(2) = "Fixed"
> arrDRV(3) = "Remote"
> arrDRV(4) = "CDROM"
> arrDRV(5) = "RAMDisk"
> Dim arrVBS(11)
> Dim strVBS
> '*
> Dim objFSO
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> If (objFSO.DriveExists(cDRV)) Then
> Dim objGDR
> Set objGDR = objFSO.GetDrive(cDRV)
> If (objGDR.IsReady) Then
> arrVBS(0) = FormatNumber(objGDR.AvailableSpace,0)
> arrVBS(1) = objGDR.DriveLetter
> arrVBS(2) = objGDR.DriveType & " (" &
arrDRV(objGDR.DriveType)
> & ")"
> arrVBS(3) = objGDR.FileSystem
> arrVBS(4) = FormatNumber(objGDR.FreeSpace,0)
> arrVBS(5) = objGDR.IsReady
> arrVBS(6) = objGDR.Path
> arrVBS(7) = objGDR.RootFolder
> arrVBS(8) = objGDR.SerialNumber
> arrVBS(9) = objGDR.ShareName
> arrVBS(10) = FormatNumber(objGDR.TotalSize,0)
> arrVBS(11) = objGDR.VolumeName
> '*
> strVBS = strVBS & " AvailableSpace = " & arrVBS(0) &
> vbCrLf
> strVBS = strVBS & " DriveLetter = " & arrVBS(1) &
> vbCrLf
> strVBS = strVBS & " DriveType = " & arrVBS(2) &
> vbCrLf
> strVBS = strVBS & " FileSystem = " & arrVBS(3) &
> vbCrLf
> strVBS = strVBS & " FreeSpace = " & arrVBS(4) &
> vbCrLf
> strVBS = strVBS & " IsReady = " & arrVBS(5) &
> vbCrLf
> strVBS = strVBS & " Path = " & arrVBS(6) &
> vbCrLf
> strVBS = strVBS & " RootFolder = " & arrVBS(7) &
> vbCrLf
> strVBS = strVBS & " SerialNumber = " & arrVBS(8) &
> vbCrLf
> strVBS = strVBS & " ShareName = " & arrVBS(9) &
> vbCrLf
> strVBS = strVBS & " TotalSize = " & arrVBS(10) &
> vbCrLf
> strVBS = strVBS & " VolumeName = " & arrVBS(11) &
> vbCrLf
> strVBS = strVBS & " ====================== " & vbCrLf
> Else
> strVBS = "Drive '" & cDRV & "' is not ready or contains a
blank
> CD."
> End If
> Set objGDR = Nothing
> Else
> strVBS = strVBS & " Drive '" & cDRV & "' does not exist!"
> End If
> Set objFSO = Nothing
> '*
> WScript.Echo(strVBS)
>
>