add depth to getDirectory in order to know where we are