Untitled
unknown
plain_text
18 days ago
551 B
2
Indexable
$sourceFolder = "C:\Path\To\Your\Files" $destinationZip = "C:\Path\To\Your\Archive.zip" $startDate = Get-Date "2024-01-01" $endDate = Get-Date "2024-01-31" $filesToZip = Get-ChildItem -Path $sourceFolder -File | Where-Object { $_.LastWriteTime -ge $startDate -and $_.LastWriteTime -le $endDate } if ($filesToZip.Count -gt 0) { Compress-Archive -Path $filesToZip.FullName -DestinationPath $destinationZip -Force Write-Host "Files zipped successfully to $destinationZip" } else { Write-Host "No files found in the specified date range." }
Editor is loading...
Leave a Comment