Skip to content

Instantly share code, notes, and snippets.

@tech-zombie
Last active January 9, 2019 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tech-zombie/466d8d6ca0e4f84cd68448ad8445ce42 to your computer and use it in GitHub Desktop.
Save tech-zombie/466d8d6ca0e4f84cd68448ad8445ce42 to your computer and use it in GitHub Desktop.
Powershell to get newest file in folder
function Get-NewestFile
{
param($PathToDirectory)
$NewestFile = Get-ChildItem $PathToDirectory | sort LastWriteTime | select -last 1
$PathToNewestFile = $PathToDirectory + "\" + $NewestFile
$PathToNewestFile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment