View Single Post
Old 06-05-2008   #3 (permalink)
Hal Rottenberg


 
 

Re: File name prefix?

Jacques wrote:
Quote:

> 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?
Try the BaseName property.

PS > ls | select -first 3 | ft basename

BaseName
--------
2007-07-02@xxxxxx-07-33
bob_
cd-images


--
Author, Tech Prosaic blog (http://halr9000.com)
Webmaster, Psi (http://psi-im.org)
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast (http://powerscripting.net)
My System SpecsSystem Spec