I learned how to loop over files in a folder: https://www.stata.com/statalist/arch.../msg00620.html
I learned how to loop over variables in a file: https://www.stata.com/statalist/arch.../msg01140.html
But now I want to "cd" to each and all subfolders of my main "upper most" folder, and then do some operations.
If the upper most folder contains "ultimate" and "main". And "ultimate" contains "rabbit" and "dog", and "main" contains "tiger" and "lion" and "cat". Then if I do what I want in a manual way, it will be like this.
But I am wondering if this can be made smart by something like this:
I learned how to loop over variables in a file: https://www.stata.com/statalist/arch.../msg01140.html
But now I want to "cd" to each and all subfolders of my main "upper most" folder, and then do some operations.
If the upper most folder contains "ultimate" and "main". And "ultimate" contains "rabbit" and "dog", and "main" contains "tiger" and "lion" and "cat". Then if I do what I want in a manual way, it will be like this.
Code:
cd ultimate cd rabbit (some operations) cd .. cd dog (some operations) cd .. cd .. cd main cd tiger (some operations) cd .. cd lion (some operations) cd .. cd cat (some operations) cd ..
Code:
Code loop over "ultimate" and "main" { Code to loop over "rabbit" and "dog" when it's "ultimate" Code to loop over "tiger" and "lion" and "cat" when it's "main" }
Comment