添加了脚本Libclean.ps1用来删除所有的临时文件

经过一场严重的AI滥用事故后得到的东西
This commit is contained in:
2024-03-16 17:04:08 +08:00
parent 05d7e4ac6e
commit caf38e1e9f
5 changed files with 32 additions and 17 deletions

32
Libclean.ps1 Normal file
View File

@@ -0,0 +1,32 @@
# DeleteSpecificLogs.ps1
# 定义要搜索的起始目录,这里使用脚本所在的目录
$startDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
# 递归地搜索指定目录及其子目录,并删除匹配的文件
Get-ChildItem -Path $startDirectory -File -Recurse |
Where-Object { $_.Name -match '.*\.log' } |
Remove-Item -Force -Verbose
# 递归地搜索指定目录及其子目录,并删除匹配的文件
Get-ChildItem -Path $startDirectory -File -Recurse |
Where-Object { $_.Name -match '.*\.log,[0-9]+$' } |
Remove-Item -Force -Verbose
# 递归地搜索指定目录及其子目录,并删除匹配的文件
Get-ChildItem -Path $startDirectory -File -Recurse |
Where-Object { $_.Name -match '.*\.jrl' } |
Remove-Item -Force -Verbose
# 递归地搜索指定目录及其子目录,并删除匹配的文件
Get-ChildItem -Path $startDirectory -File -Recurse |
Where-Object { $_.Name -match '.*\.jrl,[0-9]+$' } |
Remove-Item -Force -Verbose
# 递归地搜索指定目录及其子目录,并删除匹配的文件
Get-ChildItem -Path $startDirectory -File -Recurse |
Where-Object { $_.Name -match '.*\.tag' } |
Remove-Item -Force -Verbose
# 输出完成信息
Write-Host "删除特定格式的日志文件完成。"