I didn't feel like learning your code because I provided a solution to get you to a list of directories. Picking up where my code left off you could do something like this:
foreach($filePath in $filePaths)
{
}
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato