Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Latest File in all Sub Folders of a Share

Status
Not open for further replies.

B4everlovinjah

IS-IT--Management
May 10, 2016
1
GB
Hi,

I'm never written or used a PS script. I need to get to understand PS. What I need is a script that will give me the latest file name and date stamp in every folder beneath the folder share.

Any Help will be very welcome.

Thanking any PS experts in advance.

 
Something like this might get you heading in the right direction at least:

Code:
$myDirectory = "C:\Temp"
$myFiles = Get-ChildItem $myDirectory -Recurse -File
$myFiles | Group-Object Directory | foreach {
    $_.Group | sort LastWriteTime | select -Last 1 Directory,Name,LastWriteTime
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top