Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $source = "R:\"
- Get-ChildItem -LiteralPath $source -File | ForEach-Object {
- $year = $_.LastWriteTime.Year.ToString()
- $dest = Join-Path $source $year
- if (-not (Test-Path -LiteralPath $dest)) { New-Item -Path $dest -ItemType Directory | Out-Null }
- Move-Item -LiteralPath $_.FullName -Destination $dest
- }
Advertisement