Hello everybody,
first post and very new to Stata. I'm doing a university course on it and one requirement for passing the first assignment reads "the do-file runs twice in a row if it is started from this lectures root-directory".

I've come very close with

local files: dir "C:\filepath" files "x.do"
foreach file in `files' {
do `file'

[here is the rest of the script before the closing bracket]

}

But this makes the do file run infinitely.
I think I'm missing something very obvious that is just not clear to me, because my solution is probably not what our teacher has in mind. I've been sitting three days on this, so I'd be very grateful for any help!
Thank you and have a wonderful day