<p>Anyone happen to have a sample script for recursing a given directory in a filesystem with Powershell? Ultimately what I'm wanting to do is create a script that will generate NSIS file lists for me given a directory. Something very similar to what was done <a href="http://blogs.oracle.com/duffblog/2006/12/dynamic_file_list_with_nsis.html" rel="nofollow noreferrer">here</a> with a BASH script.</p>

This is a "paraphrase" port of that bash script.
```
```
$path = "c:\path\to\program"
$installFiles = "installfiles_list.txt"
$uninstFiles = "uninstfiles_list.txt"
$files = get-childitem -path $path -recurse | where-object { ! $_.psIsContainer } # won't include dirs
$filepath = $files | foreach-object { $_.FullName }
$filepath | set-content $installFiles -encoding ASCII
$filepath[($filepath.length-1)..0] | set-content $uninstFiles -encoding ASCII
```
```