I’m using the following to quickly find specific files from powershell CLI.
[IO.Directory]::GetFiles($searchDir, $searchFile, [IO.EnumerationOptions] @{AttributesToSkip='Hidden,Device,Temporary,SparseFile'; RecurseSubdirectories=$true; IgnoreInaccessible=$true })
This is aliased in a function, and when I run it and it has found a match, but still searching for more, I cannot interrupt (CTRL+C
) the call, forcing me to wait for all results.
Q: How can I can enable interrupting the process once a match is found?