On 06/06/2009 9:19 AM, Dennis Fisher wrote:
Colleagues,
R 2.9.0
Windows XP
Task is as follows:
A folder FOLDERNAME exists at the root level of some drive, e.g., E:
\FOLDERNAME
I want to search all possible drives to find the location of this
folder but I don't know what drives exist or are mounted.
The command:
dir(path="C:/", pattern=FOLDERNAME)
happens to be successful.
However, the command:
dir(path="C:/", pattern=FOLDERNAME)
results is a pop-up message:
"There is no disk in the drive. Please insert a disk into drive D:"
Can I avoid the pop-up message? i.e., can I execute a command that
silently reports only successes?
I think that's quite hard, because the action on failure depends on the
drive type. It's coming from the device driver, not from R. I'd guess
your drive D: is a CD drive, for example. If you do the same with Z:/
(assuming you don't have a drive Z: defined), you won't get the popup,
but you'll get a warning from R because Z:/ is not readable.
So to do this, you'd need code to recognize what kind of drive you had,
what sort of problems there could be, and avoid triggering them.
Duncan Murdoch
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.