I'm trying to recursively rename a bunch of [TFS](http://en.wikipedia.org/wiki/Team_Foundation_Server) folders using `tf rename`, [PowerShell](http://en.wikipedia.org/wiki/Windows_PowerShell) and a regular expression but I'm having some issues with PowerShell as I haven't spent much time with it. This is what I've put together so far to replace a leading `5` with `2.3.2` but it isn't working:

```
dir | foreach { tf rename $_ { $_.Name -replace '^5', '2.3.2' } }

```

Actual result:

```

Unrecognized command option 'encodedCommand'.
Unrecognized command option 'encodedCommand'.
Unrecognized command option 'encodedCommand'.
Unrecognized command option 'encodedCommand'.
...etc.

```

Update:

I got a little closer by doing the following instead:

```
dir | foreach { $newname = $_.Name -replace "^5", "2.3.2"; tf rename $_ $newname }

```

My next goal is to make this recurse subdirectories but this seems a bit more challenging (changing it to `dir -recurse` makes it quit after the parent folders for some reason).