If you start in Folder1
, you could do:
for i in */
do
(cd "$i"Gex_experiments && qsub myscript.sh)
done
The trailing slash */
means that only directories will be found. The ( )
surrounding the loop mean that the command is run within a subshell, so you don't need to cd
back out.