header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Latest File Created
Last Post 03 Mar 2010 03:35 AM by Bobdee. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
BobdeeUser is Offline
Basic Member
Basic Member
Posts:130
Avatar

--
03 Mar 2010 03:04 AM
    Hi,

    I would like to grab the filename of the latest file created within a directory, but am unsure of the command to do it.  Can anyone point me in the right direction??

    Here is what I am working with at the mo....

    Get-ChildItem '*1620020*' | where {$_.length -GT 100}...  Get the latest file created from this list.

    I've poked about with some cmdlets - like get-childitem, but i cannot seem to grab what it need.

    Thanks in advance for any help

    Robbie.
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    03 Mar 2010 03:22 AM
    $LastFile = Get-ChildItem *1620020* | Sort-Object CreationTime -Descending | Select-Object -First 1
    $LastFile.Name

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    BobdeeUser is Offline
    Basic Member
    Basic Member
    Posts:130
    Avatar

    --
    03 Mar 2010 03:35 AM
    Thanks Shay, thats great.

    Robbie
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer