Skip to content

Instantly share code, notes, and snippets.

@aaronhoffman
Created June 5, 2018 13:25
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 aaronhoffman/871604e55647687e7bc20c1b25cbe264 to your computer and use it in GitHub Desktop.
Save aaronhoffman/871604e55647687e7bc20c1b25cbe264 to your computer and use it in GitHub Desktop.
PowerShell script to copy files older than a given date
# copy files older than a given date
$items = Get-ChildItem -Path ".\" | Where-Object { $_.CreationTime -le "12/31/2017" }
Write-Output "count $($items.Length)"
foreach ($item in $items)
{
Move-Item -Path $item.FullName -Destination "c:\destination\$($item.Name)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment