A piece of my work around PowerShell and IIS (or usefull things I've found on the web). Mostly some reminders for myself!

Here’s a script to count files under the specified path (or the working directory if the parameter is omitted) and times the operation progress, in real time.


CountFiles - File counter and timer.
CountFiles - Counts files under the specified path and times the operation progress in real time.
Sets the directory where the files will be counted.
File Name  : CountFiles.ps1
Author     : Fabrice ZERROUKI - fabricezerrouki@hotmail.com
PS D:\>CountFiles.ps1 -path D:\Docs
The script will count all the files (recurse) under D:\Docs and display its progress in real time.
PS D:\Scripts\>CountFiles.ps1
The script will count all the files (recurse) under D:\Scripts\ (the current directory) and display its progress in real time.
Param (
[Parameter(ValueFromPipeline=$True,HelpMessage="Please enter a valid path.")]
[ValidateScript({((Test-Path $_) -and (Test-Path $_ -PathType 'Container'))})]
Write-Host "`nDefined path is `"$Path`"`n" -ForegroundColor Yellow

function time_pipeline {
param ($increment=1000)
begin{$i=0 ; $timer=[diagnostics.stopwatch]::startnew()}
process {
if (!($i % $increment)) { Write-Host “`rProcessed $i in $($timer.elapsed.totalseconds) seconds” -nonewline }
end {
Write-Host “`rProcessed $i files in $($timer.elapsed.totalseconds) seconds”
Write-Host "`tAverage rate: $([int]($i/$timer.elapsed.totalseconds)) files/sec.`n"
Get-ChildItem $Path -Recurse | Where { ! $_.PSIsContainer } | time_pipeline | Set-Variable files


good idea, I like it…


Just to let you know your site looks really strange in Opera on my office computer Linux.


Really? Which versions of Linux and Opera?
Because I often test with Browsershots and Adobe BrowserLab and I see no problem with the versions I tested


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top