Skip to content

Instantly share code, notes, and snippets.

@tcshao
tcshao / DeleteOldTextFiles.ps1
Last active October 11, 2015 03:38
Deleting *.txt files from 'c:\temp' and subdirectories more than 5 days old
<# Deleting *.txt files from 'c:\temp' and subdirectories more than 5 days old #>
Get-ChildItem 'C:/temp' -Recurse -Include '*txt'
| WHERE { ($_.CreationTime -le $(Get-Date).AddDays(-5)) }
| Remove-Item
@tcshao
tcshao / replaceNumbers.ps1
Last active October 11, 2015 02:48
Simple powershell loop and replace
<# Loop through IRC log File #>
$quotes = @()
$dest = 'out.txt'
Get-Content in.txt | % {
$line = $_ -replace '.*?[0-9]:',''
$line = $line -replace '"',''
$quotes += $line
}