Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run all TCL scripts in a folder

Tags:

tcl

vivado

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 ?

like image 641
AryT Avatar asked Dec 25 '22 22:12

AryT


2 Answers

How about

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

?

Documentation: foreach, glob, source

like image 173
Peter Lewerin Avatar answered Feb 05 '23 08:02

Peter Lewerin


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).

like image 22
TM90 Avatar answered Feb 05 '23 06:02

TM90