I am trying to create a procedure that searches the PC to find out what Drives [logical] exist on a system.
This is in a windows environment.
The reason is to be able to search for a specific directory that should exist on the PC.
So using :
set volumes [file volume]
regsub {\s} $volumes {} drives
set drive [split drives /]
gets me the drive list, then using a foreach loop I can use
cd $drive
and then
if {[file exists "FindDirectory"] == 1 }{
'do something in that directory'
}
This works fine until I reach a CDROM drive at which point Tcl says it cannot change directory to this drive and so grinds to a halt..
Is there some way I can get Tcl to skip over the CDROM by recognising it is not a writable device or some other parameter that can be used so the loop can be caused to skip over it using 'continue'
This is in a windows environment.
The reason is to be able to search for a specific directory that should exist on the PC.
So using :
set volumes [file volume]
regsub {\s} $volumes {} drives
set drive [split drives /]
gets me the drive list, then using a foreach loop I can use
cd $drive
and then
if {[file exists "FindDirectory"] == 1 }{
'do something in that directory'
}
This works fine until I reach a CDROM drive at which point Tcl says it cannot change directory to this drive and so grinds to a halt..
Is there some way I can get Tcl to skip over the CDROM by recognising it is not a writable device or some other parameter that can be used so the loop can be caused to skip over it using 'continue'