How to? @files and trapping "no disk in drive errors"

Mar 17, 2013
11
0
#1
Because of the way Windows grabs drive letters for USB externals being plugged in, sometime the following doesn't work. Drive j: sometimes is a external USB hard drive and sometimes is a Kingston USB card reader with no card in it.

@set h=%@files["j:\externaldrivename.txt"]
I just want to test if an external drive is is attached on J: and find out if a file exists on the drive. But if the external is not plugged in, and a cardreader is plugged in and gets a hold of drive j: the entire thing errors out with a No Disk error window:

There is no disk in the drive. Please insert a disk into the drive \device\harddisk6\dr10
Is there a way to trap this error? (these usb card readers have a way of grabbing a bunch of drive letters even if nothing is going on)
 
#3
Because of the way Windows grabs drive letters for USB externals being plugged in, sometime the following doesn't work. Drive j: sometimes is a external USB hard drive and sometimes is a Kingston USB card reader with no card in it.



I just want to test if an external drive is is attached on J: and find out if a file exists on the drive. But if the external is not plugged in, and a cardreader is plugged in and gets a hold of drive j: the entire thing errors out with a No Disk error window:



Is there a way to trap this error? (these usb card readers have a way of grabbing a bunch of drive letters even if nothing is going on)
How about the @READY function?

-- Howard
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,609
46
Albuquerque, NM
prospero.unm.edu
#4
Two ideas -- I haven't tested either:

1. You may be able to redirect the error message by putting the command containing the @FILES function in a command group.

2. I believe USBDLM offers an option to not assign drive letters to USB card readers unless they actually contain some media.