title: How can I retrieve recursive directory name w/ Powershell?
body: <p>I am attempting to use Powershell to automate the builds of projects using a cli compiler/linker.  I want to place the script in the root directory of a project and have it check for all source files recursively and compile them, with the compiler output pointed at the same directory as the source files.  I would also like to collect a list of the *.c as a comma-delimited variable as input to the linker.  This is the typical situation:</p>
  
  <pre><code>//projects/build_script.ps
  //projects/proj_a/ (contains a bunch of source files)
  //projects/proj_b/ (contains a bunch of source files)
  </code></pre>
  
  <p>I wish to scan all the sub directories and compile the source for each *.c file.  This is what I have so far:</p>
  
  <pre><code>$compilerLocation = "C:\Program Files (x86)\HI-TECH Software\PICC-18\PRO\9.63\bin\picc18.exe";
  $args = "--runtime=default,+clear,+init,-keep";
  $Dir = get-childitem C:\projects -recurse
  $List = $Dir | where {$_.extension -eq ".c"}
  $List | $compilerLocation + "-pass" + $_ + $args + "-output=" + $_.current-directory;
  </code></pre>
  
  <p>I realize that $_.current-directory isn't a real member, and I likely have other problems with the syntax.  I apologize for the vagueness of my question, I am more than willing to further explain what may seem unclear.</p>