not like:
Code: Select all
source scr/script1.tcl
source scr/script2.tcl
.
.
.
Code: Select all
source scr/alscripts.tcl
Code: Select all
source scr/script1.tcl
source scr/script2.tcl
.
.
.
Code: Select all
source scr/alscripts.tcl
Code: Select all
set scriptdir scr/
foreach script [glob $scriptdir\*.tcl] {
source $script
}
Code: Select all
set scriptdir scr/
foreach script [lsort -dictionary [glob $scriptdir\*.tcl]] {
source $script
}
Code: Select all
#Will sort and load the files from alphabetically increasing first letters of file names
#(A to Z)
[lsort -dictionary -increasing [glob $scriptdir\*.tcl]]
#Will sort and load the files from alphabetically decreasing first letters of file names
#(Z to A)
[lsort -dictionary -decreasing [glob $scriptdir\*.tcl]]
Code: Select all
foreach script [glob scripts/*] {
if {(![file isdirectory $script]) && ([regexp {^(.+)\.tcl$} $script])} {
catch {source $script} error
if {$error != ""} {
putlog "ERROR: the following error occured while evaluating ${script}: $error"
}
}
}