-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript_tl.ps1
29 lines (25 loc) · 1001 Bytes
/
script_tl.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Author: github.com/rogerrius
# Vars
$path = "$env:USERPROFILE\AppData\Roaming\.minecraft\mods"
$filePattern = "tl_skin_cape*"
# Execute the function in the background
Start-Job -ScriptBlock {
# Define the function to monitor and delete files
function Monitor-And-DeleteFiles {
param (
$path,
$filePattern
)
Write-Host "Monitoring started for $path\$filePattern"
while ($true) {
$files = Get-ChildItem -Path $path -Filter $filePattern
foreach ($file in $files) {
Remove-Item -Path $file.FullName -Force
Write-Host "$($file.Name) deleted at $(Get-Date)"
}
Start-Sleep -Seconds 1 # Wait for 1 second before checking again. Do not change.
}
}
# Call the function with the appropriate parameters
Monitor-And-DeleteFiles -path "$env:USERPROFILE\AppData\Roaming\.minecraft\mods" -filePattern "tl_skin_cape*"
}