Public/ps1/Files/Start-ApprxrFileWatchers.ps1
|
<#
.SYNOPSIS Starts all file watchers for all configured Apprxr watch folders. .DESCRIPTION Reads all available file watcher locations from configuration and starts a background task for each using Watch-ApprxrFolder. Used to initialize all watchers at once. .EXAMPLE Start-ApprxrFileWatchers Starts all configured file watchers. .NOTES This function is part of the Apprxr file watcher management system. #> function Start-ApprxrFileWatchers { # Import the private function to get all watcher locations $locations = Get-ApprxrFileWatcherLocations if (-not $locations) { Log "No file watcher locations configured." return } foreach ($name in $locations.Keys) { $config = $locations[$name] $inputFolder = $config.InputFolder $filters = $config.Filter if (-not $filters) { $filters = '*' } if ($inputFolder) { if ($filters -is [string]) { $filters = @($filters) } foreach ($filter in $filters) { Log "Starting watcher for: $name ($inputFolder) with filter: $filter" Start-Job -ScriptBlock { param($folder, $filter) Import-Module $using:PSModulePath Watch-ApprxrFolder -Path $folder -Filter $filter } -ArgumentList $inputFolder, $filter | Out-Null } } } Log "All configured file watchers started." } |