Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checking if a card reader drive has folders 1

Status
Not open for further replies.

beedubau

Programmer
Jan 7, 2003
97
AU
I am still attempting to read media files from a media drive.
I have the code
Code:
FOR I = 4 TO 26 && Loop through drive letters D thru Z
	cDRIVE = CHR(I + 64)
	nDTYPE = DRIVETYPE(cDRIVE) && Determine drive type
	
	IF nDTYPE = 2 && Floppy drive or card reader slot
				
	  IF validpath(cDRIVE +':\DCIM\')  <<<<<<<<<<

		=pic_getfiles(cDRIVE +':\DCIM\')

        ENDIF

	ENDIF

ENDFOR

pic_getfiles() is my own prg

This works fine for a known drive with a card in it.

if a drive letter for a media card reader does not have a card in it, this line (<<<<<< )gives an error.

<<<<<< = IF validpath(cDRIVE +':\DCIM\')

How can I test if a media card reader drive has a card in it to enable a check to be made for the DCIM folder?

Regards

Bryan
 
I don't knowhow you programmed validpath(), but a simple Directory(cDrive+':\DCIM\') should wokr instead.

Bye, Olaf.
 
Olaf,

Even with your directory function I get an error on an empty card reader drive.

Exception Processing Message c00000013 etc etc

The drive itself is listed in My Computer.

Regards

Bryan
 
nowadays the simplest might be:

Code:
oFSO = CREATEOBJECT("Scripting.FileSystemObject")
? oFSO.FolderExists(cDrive+":\")

Bye, Olaf.
 
or

Code:
oFSO = CREATEOBJ('Scripting.FileSystemObject')
oDrive = oFSO.GetDrive(cDrive+":")
? oDrive.IsReady
[/codee]

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top