4

I have a folder with many TCL files, and I need to run them all (in Vivado). How can I save time in running all of them at once? Is there something as easy as: source [path/]*.tcl ?

Kara
  • 6,115
  • 16
  • 50
  • 57
AryT
  • 43
  • 1
  • 5

3 Answers3

8

How about

foreach script [glob -nocomplain -dir $dir *.tcl] {source $script}

?

Documentation: foreach, glob, source

Peter Lewerin
  • 13,140
  • 1
  • 24
  • 27
2

You could first just find all tcl files with the glob command and then go though the list of tcl files and source them.

set $dir your/path
foreach file [glob -dir $dir */*.tcl] {
    source $file
}

Edit: In difference to Peters example this solution also sources .tcl files in subdirectories (Be sure you want this).

TM90
  • 680
  • 7
  • 21
0

To run all the scripts in a given directory and its sub-directories you may use the tcllib as follows:

package require fileutil
foreach script [fileutil::findByPattern $baseDir *.tcl] {
    source $script
}
Mostafa Wael
  • 2,750
  • 1
  • 21
  • 23