Many times, you will need to search for specific file types by searching large drives. While on small drives performance might not be an issue, on large drives it is important to get the job right in a shortest amount of time.
In this test, I looked at three ways to search for an imaginary file type of ttt.
1. -include
2. -filter
3. where-object
The result shows -filter is a much better choice for locating specific file types and most likely to search other objects as well.
Details
measure-command{Get-ChildItem -path c:\windows\ -include *.ttt -recurse -ea Silentlycontinue}
Seconds : 33
Milliseconds : 118
Ticks : 331181986
TotalDays : 0.000383312483796296
TotalHours : 0.00919949961111111
TotalMinutes : 0.551969976666667
TotalSeconds : 33.1181986
TotalMilliseconds : 33118.1986
measure-command{Get-ChildItem -path c:\windows -filter *.ttt -recurse -ea Silentlycontinue }
Seconds : 6
Milliseconds : 790
Ticks : 67907668
TotalDays : 7.8596837962963E-05
TotalHours : 0.00188632411111111
TotalMinutes : 0.113179446666667
TotalSeconds : 6.7907668
TotalMilliseconds : 6790.7668
measure-command{Get-ChildItem -path c:\windows -recurse -ea Silentlycontinue | Where-Object {$
_.Extension -eq ".ttt"}}
Seconds : 34
Milliseconds : 210
Ticks : 342106565
TotalDays : 0.000395956672453704
TotalHours : 0.00950296013888889
TotalMinutes : 0.570177608333333
TotalSeconds : 34.2106565
TotalMilliseconds : 34210.6565
Graphical View
Note: Each command was run three times to ensure reliability of findings.
No comments:
Post a Comment