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

Disable and Enable Trace Logging for Dynamics CRM

# Set common variables $serverTracingRegistry='Registry::HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\MSCRM' # Enable CRM Tracing Add-PSSnapin Microsoft.Crm.PowerShell $setting = Get-CrmSetting TraceSettings…

PowerShell: Expand Volume of Virtual FileServer Role

Option 1: Expanding disk of a Virtual Machine in Hyper-V # ExpandVolumeVirtualFileServerRole.ps1 # Update these…

PowerShell: Hobocopy Backup Software

# hobocopy-backup.ps1# Note: this is a quick snippet to demonstrate the use of this utility.#…