Created
June 5, 2018 13:25
-
-
Save aaronhoffman/871604e55647687e7bc20c1b25cbe264 to your computer and use it in GitHub Desktop.
PowerShell script to copy files older than a given date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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