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

PowerShell: Install RSAT

What problem does this solve? dcdiag /test:dns dcdiag : The term 'dcdiag' is not recognized…

PowerShell: Fix All VMs CPU Compatibility Setting

# fixAllVmCpuCompatibility.ps1 # version 0.01 function getHyperVHostsInForest{ function includeRSAT{ $ErrorActionPreference='stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #$rsatWindows7x32='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x86-RefreshPkg.msu' $rsatWindows7x64='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x64-RefreshPkg.msu'…

Adding a Domain Security Group into the Hyper-V Administrator Users Group

Issue: Resolution: Click Start > Control Panel > Administration Tools > Computer Management > System Tools…