title: PASCAL: Looping through an array to create folders?
body: <p>So I am creating a pascal script that will create a directory within a main directory and ALSO create multiple folders inside of that new directory. (Insert XZibit pun)</p>
  
  <p>Now the way we do this where I work, we send these variables to an exe that will then create directories based on what is being passed (in this case, path 'fullpath').</p>
  
  <p>I am not sure if I am approaching this correctly and would love the much more prominent PASCAL guru's input :)</p>
  
  <pre><code>const
  ARRAY1: Array[1..9] of String = (
       'NQN', 'Documents', 'Correspondences',
       'Worksheets', 'Reports', 'Claims',
       'Certificate of Insurance', 'Invoice', 'Monthly Reports'
  );
  var
  i: Integer;
  fullpath, path, name, os, es, cmd: String;
  Code : LongWord;
  res: Integer;
  
  Begin
  path := 'Policies'
  fullpath := path+'\'+[i]
       for i := 1 to 9 do
      IF(ReqList.Values['sRM_ID'] = '') then
          Begin
              cmd := 'C:\XXX\bin\mkdir.exe "'+fullpath+'"';
              res :=ExecuteProc(cmd, 'C:\XXX\bin', true, -1, true, nil, os, es, code);
              if(res = 0) then
                  Begin
                      ReqList.values['NoErrors'] := '1';
                      ReqList.Values['Response_content']:=  '{"valid":"1","message":"'+ReplaceString(ReplaceString(os,#13,'',false),#10,'',false)+'"}';
                  end
              else
                  begin
                      ReqList.Values['NoErrors'] := '0';
                      Reqlist.Values['Response_Content'] := '{"valid":"0","message":"'+ReplaceString(ReplaceString(os,#13,'',false),#10,'',false)+'"}';
                  end;
          END
          ELSE
                  Begin
                      ReqList.Values['Response_Content'] := '{"valid":"0","message":"A folder or file with the same name already exists."}';
                  End;
                      ReqList.Values['Response_ContentType'] := 'HTML';
  </code></pre>