Last active
October 10, 2025 04:00
-
-
Save GluTbl/40db283e14a54308dfc497c59c9c9a92 to your computer and use it in GitHub Desktop.
[Search files in WIndows] #powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Find-Exact-FileWithProgress { | |
param ( | |
[string] $BasePath, | |
[string] $FileName | |
) | |
$files = Get-ChildItem -Path $BasePath -Recurse -File -ErrorAction SilentlyContinue | |
$total = $files.Count | |
$counter = 0 | |
foreach ($f in $files) { | |
$counter++ | |
Write-Progress -Activity "Searching in $BasePath" -Status "$counter / $total" -PercentComplete (($counter / $total) * 100) | |
if ($f.Name -eq $FileName) { | |
Write-Output $f.FullName | |
} | |
} | |
Write-Progress -Activity "Searching in $BasePath" -Completed | |
} | |
#Find-Exact-FileWithProgress -BasePath "C:\Path\To\Your\Folder" -FileName "file.dll" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Find-Match-FileWithProgress { | |
param ( | |
[string] $BasePath, | |
[string] $Pattern | |
) | |
$files = Get-ChildItem -Path $BasePath -Recurse -File -ErrorAction SilentlyContinue | |
$total = $files.Count | |
$counter = 0 | |
foreach ($f in $files) { | |
$counter++ | |
Write-Progress -Activity "Searching in $BasePath" -Status "$counter / $total" -PercentComplete (($counter / $total) * 100) | |
if ($f.Name -like $Pattern) { | |
Write-Output $f.FullName | |
} | |
} | |
Write-Progress -Activity "Searching in $BasePath" -Completed | |
} | |
#Find-Match-FileWithProgress -BasePath "C:\Users\v\Downloads\tmp" -Pattern "*.dll" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment