File structure
File1
test.pdb
xyz.txt
File2
test.pdb
xyz.txt
File3
test.pdb
xyz.txt
I want to loop in through all folders in the directory and run the following code which is in textfile autopsf.tcl on Tk console :
package require autopsf
mol new test.pdb
autopsf -mol 0
package require solvate
solvate test_autopsf.psf test_autopsf.pdb -t 5 -o solvate
package require autoionize
autoionize -psf solvate.psf -pdb solvate.pdb -neutralize
I am running the following code at the moment :
for d in ./*/ ; do
source autopsf.tcl
done
This code worked for me:
foreach file [glob -nocomplain "./*/"] {
cd $file
source autopsf.tcl
cd ..
}