Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.