Powershell – is it a crime not to use it? Looping over files and running commands

So, I HAVE to bite the bullet. A colleague of mine started using it 3 months ago, another SQL mentor has been badgering me to use it (and to love bitcoin) for a LONG while. Today, I will record links to some basic looping structures. This is like unix (a good thing) but object oriented with full API access it seems. Neat! And … I am hooked now even if I am a late adopter and am finally giving up dos scripts (yet I am a unix shell junkie) 🙁

My final commands were

dir -recurse -include *.xec | %{pdt -fo $_.FullName}
dir -recurse -include *.xe* | %{migratedsp -f $_.FullName -dest $_.DirectoryName}

where pdt is the .exe file that does something to the filenames. Note that % is a short form of foreach. The object that has the methods FullName and DirectoryName are listed on msdn and is the FileInfo class that we know and love in other scripting languages.