例: 定期删除3天前的日志
$FilePath = "C:\Windows\System32\LogFiles"
$DaysAgo=3
$Today=Get-Date
Get-ChildItem -Path $FilePath "*.log" | Where-Object {$_.LastWriteTime -lt $Today.AddDays(-$DaysAgo)} |Remove-Item
史振宁的技术博客 博主文章分类:WindowsServer ©著作权
文章标签 删除日志 powershell 文章分类 运维
例: 定期删除3天前的日志
$FilePath = "C:\Windows\System32\LogFiles"
$DaysAgo=3
$Today=Get-Date
Get-ChildItem -Path $FilePath "*.log" | Where-Object {$_.LastWriteTime -lt $Today.AddDays(-$DaysAgo)} |Remove-Item
nginx日志定期归档脚本
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M