cbergeron

Untitled

Oct 6th, 2026
24,597
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. $source = "R:\"
  2. Get-ChildItem -LiteralPath $source -File | ForEach-Object {
  3. $year = $_.LastWriteTime.Year.ToString()
  4. $dest = Join-Path $source $year
  5. if (-not (Test-Path -LiteralPath $dest)) { New-Item -Path $dest -ItemType Directory | Out-Null }
  6. Move-Item -LiteralPath $_.FullName -Destination $dest
  7. }
Advertisement