2005-09-05

Monad: Needs Some Work

Monad, the new Microsoft command shell that was supposed to go into Longhorn, is the best thing Microsoft has made in, quite possibly, ever. Still, there are some rough edges.

Observe: I have some JPEGs I need to rename. They are titled, for some reason, 01.jpg, 02.jpg, and so on. To rename them in BSD, I can do this:

$ for i in 0*.jpg; do mv $i AB$i; done

Piece of cake. In Monad, it's slightly more complicated.

foreach ($i in get-childitem 0*.jpg) { \ 
  $p = [System.IO.Path]::GetFileName($i); move $p AB$p; }

The .NET Framework has some really nice APIs, but I don't want my shell bogged down with them. Points off.

1 comment:

Anonymous said...

not so hard to do, I think all you need is:

get-childitem 0*.jpg |
foreach-object { move-item $_ ("AB" + $_.name) }