Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Using PowerShell
>
General PowerShell
Latest File Created
Last Post 03 Mar 2010 03:35 AM by
Bobdee
. 2 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
Bobdee
Basic Member
Posts:130
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 Levy
PowerShell MVP, Admin
Veteran Member
Posts:1362
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
Bobdee
Basic Member
Posts:130
03 Mar 2010 03:35 AM
Thanks Shay, thats great.
Robbie
You are not authorized to post a reply.
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
Using PowerShell
>
General PowerShell
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2