Reputation:
Given a file is in C drive, and its path ends with "Framework64\v4.0.30319\WPF\Fonts\GlobalMonospace.CompositeFont", what is the most efficient way to find the file?
It may be able to find, for example, "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\Fonts\GlobalMonospace.CompositeFont".
I can implement it in C# or AutoHotKey. I think Directory.EnumerateFiles and loop directive will work, but what is the most efficient way?
Upvotes: 2
Views: 120
Reputation: 10603
Loop, C:\*Framework64\v4.0.30319\WPF\Fonts\GlobalMonospace.CompositeFont, , 1 ; recurse into subfolders
{
MsgBox, 4, , Filename = %A_LoopFileFullPath%
continue?
IfMsgBox, No
break
}
https://autohotkey.com/docs/commands/LoopFile.htm
Upvotes: 1
Reputation: 28499
Use Directory.EnumerateDirectories
with option SearchOption.AllDirectories
to find all directories. Then pick those whose path ends in "Framework64\v4.0.30319\WPF\Fonts". Then for those, check whether the file "GlobalMonospace.CompositeFont" exists in those directories using File.Exists
.
Upvotes: 1