So, I've got a set of directories 00-99 in a folder. Each of those directories has 100 subdirectories, 00-99. Each of those subdirectories has thousands of images.
What I'm attempting to do is basically get a progress report while it's computing the average file size, but I can't get that to work. Here's my current query:
get-childitem <MyPath> -recurse -filter *.jpeg | Where-Object { Write-Progress "Examining File $($_.Fullname)" true } | measure-object -Property length -Average
This shows me a bar that updates as each of the files gets processed, but at the end I get back no average file size data. Clearly, I'm doing something wrong, because I figure trying to hack the Where-Object to print a progress statement is probably a bad idea(tm).
Since there are millions and millions of images, this query obviously takes a VERY LONG time to work. get-childitem is pretty much going to be the bulk of query time, if I understand things correctly. Any pointers to get what I want? AKA, my result would ideally be:
Starting...
Examining File: \00\00\Sample.jpeg
Examining File: \00\00\Sample2.jpeg
Examining File: \00\00\Sample3.jpeg
Examining File: \00\00\Sample4.jpeg
...
Examining File: \99\99\Sample9999.jpg
Average File Size: 12345678.244567
Edit: I can do the simple option of:
get-childitem <MyPath> -recurse -filter *.jpeg | measure-object -Property length -Average
And then just walk away from my workstation for a day and half or something, but that seems a bit inefficient =/
Something like this?
get-childitem -recurse -filter *.exe |
%{Write-Host Examining file: $_.fullname; $_} |
measure-object -Property length -Average