Posted On March 31, 2019

PowerShell Script to Clean Up Files Older than X Days

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell Script to Clean Up Files Older than X Days
$purgePeriod = 30;

$folders = '\\FILSERVER01\ORDERS\BACKUP','C:\SFTP_BACKUP';

Get-ChildItem -path $folders | where {$_.Lastwritetime -lt (date).adddays(-$purgePeriod)} | remove-item;

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

RDP Gateway with MFA

Step 1: Install RDS Gateway   Prerequisites: 1. Enable Power Shell Remoting  2. SSL Certs…

Basic CSS: Style Multiple Elements with a CSS Class

<style>.red-text {color: red;}</style><h2 class="red-text">CatPhotoApp</h2><main><p>Click here to view more <a href="#">cat photos</a>.</p><a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute…

PowerShell: Unlimit RDP Sessions

$tsRegHive='REGISTRY::HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server' Set-ItemProperty -Path $tsRegHive -Name fSingleSessionPerUser -value 0 Set-ItemProperty -Path $tsRegHive -Name fdenyTSConnections -value…