home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Practical Programming in Tcl & Tk (4th Edition)
/
TCLBOOK4.BIN
/
pc
/
exsource.old
/
9_11.tcl
< prev
next >
Wrap
Text File
|
2003-04-15
|
398b
|
24 lines
#
# Example 9-11
# Finding a file by name.
#
proc FindFile { startDir namePat } {
set pwd [pwd]
if {[catch {cd $startDir} err]} {
puts stderr $err
return
}
foreach match [glob -nocomplain -- $namePat] {
puts stdout [file join $startDir $match]
}
foreach file {[glob -nocomplain *]} {
if [file isdirectory $file] {
FindFile [file join $startDir $file] $namePat
}
}
cd $pwd
}