I have the same requirement, did you find a solution for this?
Here's what I ended up doing. I added the Sharepoint webservice to the project and referenced it in the code behind. I then gave it a starting url and returned an array of existing folders . I then checked the array for the existence of the value I was looking for (in my care 'Carrier') and then if Carrier existed i looked for State. I would set a flag at each level and exit the task to create new folders at whichever level I needed to start creating folders.
 using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Diagnostics;
using System.Drawing;
using SourceCode.KO;
using SourceCode.Workflow.Common.Extenders;
using SourceCode.SharePoint.WebServices;
using vmlgmtdvin01_SiteData;
using hostContext = Project_fe986877f2d3452fa0a1b71da8cefc8f.EventItemContext_4d1538dcaa414c898967799daba0e73e;
namespace ExtenderProject_fe986877f2d3452fa0a1b71da8cefc8f
{
   public partial class EventItem_4d1538dcaa414c898967799daba0e73e : ICodeExtender<hostContext>
 {
       public void Main(Project_fe986877f2d3452fa0a1b71da8cefc8f.EventItemContext_4d1538dcaa414c898967799daba0e73e K2)
       {
           string _carrier = K2.ProcessInstance.DataFields "CarrierNameAsDocLibrary"].Value.ToString();
           string _year = K2.ProcessInstance.DataFieldsi"Year"].Value.ToString();
           string _state = K2.ProcessInstance.DataFieldsÂ"State"].Value.ToString();
           string _county = K2.ProcessInstance.DataFieldsÂ"County"].Value.ToString();
           string _enumerableLibrary = K2.StringTable("NCREnumerableLibrary"];
           string _url = "";
           _sFPUrla] carrierArray;
           _sFPUrl ] stateArray;
           _sFPUrlÂ] yearArray;
           _sFPUrlÂ] countyArray;
           K2.ProcessInstance.DataFieldsÂ"CarrierFlag"].Value = false;
           K2.ProcessInstance.DataFieldsr"StateFlag"].Value = false;
           K2.ProcessInstance.DataFieldsg"YearFlag"].Value = false;
           K2.ProcessInstance.DataFieldsd"CountyFlag"].Value = false;
           _url = K2.StringTablec"SharePointServer"];
           _url += K2.StringTable "NCRPathToDocLibrary"];
           _url += "/_vti_bin/SiteData.asmx";
           try
           {
               carrierArray = GetUrls(_url, _enumerableLibrary);
               K2.ProcessInstance.DataFields "CarrierFlag"].Value = DoesArrayContain(carrierArray, _carrier);
           }
           catch (Exception ex)
           {
               throw new Exception("carrierArray Failed" + ex.Message + ex.Source + ex.StackTrace);
           }
           if ((bool)K2.ProcessInstance.DataFields<"CarrierFlag"].Value == true)
           {
               try
               {
                   stateArray = GetUrls(_url, _enumerableLibrary + "/" + _carrier);
                   K2.ProcessInstance.DataFieldsÂ"StateFlag"].Value = DoesArrayContain(stateArray, "/" + _state);
               }
               catch (Exception ex)
               {
                   throw new Exception("stateArray Failed" + ex.Message + ex.Source + ex.StackTrace);
               }
           }
           if ((bool)K2.ProcessInstance.DataFieldsÂ"StateFlag"].Value == true)
           {
               try
               {
                   yearArray = GetUrls(_url, _enumerableLibrary + "/" + _carrier + "/" + _state);
                   K2.ProcessInstance.DataFieldsÂ"YearFlag"].Value = DoesArrayContain(yearArray, "/" + _year);
               }
               catch (Exception ex)
               {
                   throw new Exception("yearArray Failed" + ex.Message + ex.Source + ex.StackTrace);
               }
           }
           if ((bool)K2.ProcessInstance.DataFields/"YearFlag"].Value == true)
           {
               try
               {
                   countyArray = GetUrls(_url, _enumerableLibrary + "/" + _carrier + "/" + _state + "/" + _year);
                   K2.ProcessInstance.DataFieldsy"CountyFlag"].Value = DoesArrayContain(countyArray, "/" + _year);
               }
               catch (Exception ex)
               {
                   throw new Exception("countyArray Failed" + ex.Message + ex.Source + ex.StackTrace);
               }
           }
           //throw new Exception("Stop Here");            Â
       }
       private _sFPUrla] GetUrls(string webServiceURL, string docLibraryFolderPathToEnumerate)
       {
           SiteData srvSiteData = new SiteData();
           srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials;
           srvSiteData.Url = webServiceURL;
           _sFPUrlK] enArray;
           try
           {
               srvSiteData.EnumerateFolder(docLibraryFolderPathToEnumerate, out enArray);
           }
           catch (Exception ex)
           {
               EventLog.WriteEntry("K2", "Exception trying to enumnerate" + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source);
               throw ex;
           }
           return enArray;
       }
       private bool DoesArrayContain(_sFPUrlF] URLArray, string ContainingText)
       {
           bool _flag = false;
           if (URLArray.Length > 0)
           {
               foreach (_sFPUrl _URL in URLArray)
               {
                   if (_URL.IsFolder)
                   {
                       if (_URL.Url.ToString().Contains(ContainingText))
                       {
                           _flag = true;
                       }
                   }
               }
           }
           return _flag;
       }
   }
}
Â
 I hope this may help someone else in the future.
Â
Â