|"The following code works, but isn't there a simpler / straight forward way to do this? I actually need to set it to two directories above."|
It really depends on how you intend to use it, if you need the full path the for loop is probably the easiest way to go.
Since it's two directories up you could use:
You can either put that in the for loop or depending on the situation you may be able to use it as is instead of the variable. Most(if not all) commands support it in place of a full path.
Forgot to mention you can also reference files in the dir by tacking them on the end: