Private/Remove-SpecificFile.ps1
function Remove-SpecificFile { param ( [string]$FolderPath, [string]$LogPath, [string[]]$FilesToRemove ) foreach ($file in $FilesToRemove) { $filePath = Join-Path -Path $FolderPath -ChildPath $file if (Test-Path -Path $filePath) { Remove-Item -Path $filePath -Force Write-Log -Message "Removed file: $filePath" -LogPath $LogPath } } # Get all .url files and remove them Get-ChildItem -Path $FolderPath -Filter *.url -ErrorAction SilentlyContinue | ForEach-Object { Remove-Item -Path $_.FullName -Force Write-Log -Message "Removed URL: $($_.FullName)" -LogPath $LogPath } } |