View Single Post
Old 06-05-2008   #2 (permalink)
Marco Shaw [MVP]


 
 

Re: File name prefix?

Jacques wrote:
Quote:

> In need to list a group of files, work on each one individually, then rename
> each one with a different suffix when I've processed it. The listing and
> looping parts I've done, but I can't find a way of (easily) just getting the
> first part of a file's name. For example, I need to find and process
> 'C:\temp\firstfile.sql', then when I've finished with it, rename it
> 'C:\temp\firstfile.processed'. I can get the 'C:\temp' and '.sql' into
> variables, but I really want the 'firstfile' part. Any ideas anybody?
>
> Thanks in advance
>
> Jacques
>
>
PS> get-childitem test.ps1|select-object basename

BaseName
--------
test

Note: This is PowerShell v2 CTP2.

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec