Skip to content

Instantly share code, notes, and snippets.

@BanterBoy
Created June 29, 2018 22:01
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 BanterBoy/e2389585c058cbd800a5447547ba400a to your computer and use it in GitHub Desktop.
Save BanterBoy/e2389585c058cbd800a5447547ba400a to your computer and use it in GitHub Desktop.
Short scrappy script to locate recently created files (scripts/notes)
Clear-Host
$DaysPast = Read-Host "Enter Number of Days"
$Start = (Get-Date).AddDays(-$DaysPast)
$Path = Read-Host "Enter Search Path"
$Extenstion = Read-Host "Enter Extenstion"
Clear-Host
$Stopwatch = [system.diagnostics.stopwatch]::startNew()
Get-ChildItem -Path $Path -Include $Extenstion -Recurse |
Where-Object { $_.LastWriteTime -ge "$Start" } |
Select-Object Directory,Name,LastWriteTime |
Sort-Object LastWriteTime -Descending |
Format-Table -AutoSize
Write-Host "Search of -"$Path "- Completed!"
Write-Host "Search took" $Stopwatch.Elapsed.Milliseconds"ms."
$Stopwatch.Stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment