How do I append the previous item in array to the next item in the array for unknown number of items?
Here is what I'm trying to do. I have a string containing an LDAP path such as "OU=3,OU=2,OU=1,DC=Internal,DC=Net", I want to create each container in the above LDAP path so from the above string I need to create an array with the contents below so I can create each container. The first array item needs creating before I can create the second etc.
"OU=1,DC=Internal,DC=Net"
"OU=2,OU=1,DC=Internal,DC=Net"
"OU=3,OU=2,OU=1,DC=Internal,DC=Net"
My string example is just an example so the path may be longer or shorter and could contain 1 array item or 10+ I just don't know so I won't know how many array items there are I need to loop through them all so I have all the paths in the array.
Another example:
From "OU=Test4,OU=Number3,OU=Item2,OU=1,DC=Internal,DC=Net" I need:
"OU=1,DC=Internal,DC=Net" "OU=Item2,OU=1,DC=Internal,DC=Net" "OU=Number3,OU=Item2,OU=1,DC=Internal,DC=Net" "OU=Test4,OU=Number3,OU=Item2,OU=1,DC=Internal,DC=Net"
Thanks for the help with this.
J