Move older files with PowerShell

Move older files with PowerShell

set the source path
set the destination path
set the days 30days old = -30
set exclude files
save it as move.ps1



===========================================
$YourPath = "source"
$YourDest = "destination"
$daysback = "-30”

Get-ChildItem -Path $YourPath -Exclude abc.txt, abc.png, abc.jpg, xyz_voucher_bottom.jpg, bbc.jpg | where {$_.LastWriteTime -lt ((Get-Date).AddDays($daysback ))} |
move-item -Destination $YourDest

Comments

Popular posts from this blog

Extracting and using a modified VMWare Player BIOS or UEFI firmware

Activate Synology Active Backup for Business for DSM 6

Windows 11 internet/account bypass