Clear-HTLogFiles.ps1
function Clear-HTLogFiles { [CmdletBinding()] param ( # Base path to remove logs below. [Parameter(Position=1)] [string] $BasePath = 'C:\Program Files\CSM' ) process { $i = Read-Host -Prompt "All Log Files will be deleted, please confirm by typing 'c' and press enter " if($i -eq 'c') { Get-ChildItem -Path $BasePath -Filter *.log -Recurse | Remove-Item -Confirm:$false Write-Host "All Log Files under $BasePath is deleted" }else { Write-Host "No Files Deleted...." } } } |