- <#
- .SYNOPSIS
- Counts the Grateful Dead shows in my archives and displays
- details of the collection.
- .DESCRIPTION
- This script looks at my GD archive, and uses folder names to
- determine show type (aud, sbd, etc), and checks to see what
- shows have checked MD5s. The script also times itself.
- This is an update to an earlier script that adds separate
- counts for FLAC and SHN shows.
- .NOTES
- File Name : Count-GDShows2.ps1
- Author : Thomas Lee - tfl@psp.co.uk
- Requires : PowerShell V2 CTP3
- .LINK
- http://pshscripts.blogspot.com/2009/02/count-gdshows2ps1.html
- .EXAMPLE
- PS C:\foo> Count-GDShows2.ps1
- Count.ps1 - v 2.0.2
- +---------------------------+
- ! Dead Show Base : M:\gd !
- +---------------------------+
- Grateful Dead Show Summary
- --------------------------
- Total shows: 1146
- Soundboards: 800
- Auds : 70
- Unknown : 29
- Partial : 9
- SHN : 962
- FLAC : 137
- No coding : 47
- Broken : 4
- MD5's check: 489 (42.67 %)
- It took 0 minutes, 1 seconds
- #>
- ###
- # Start of Archive
- ##
- # Constants:
- # $GDDiskRoot - where to find shows
- # $DeadShowBase - folder at top of gd shows
- $GDDiskRoot = "M:"
- $DeadShowBase = $GDDiskRoot + "\gd"
- # Announce Ourselves
- "Count.ps1 - v 2.0.2"
- "+---------------------------+"
- "! Dead Show Base : $DeadShowBase !"
- "+---------------------------+"
- ""
- # Get start time
- $starttime = Get-Date
- # Count the Dead shows
- $Dir= ls $DeadShowBase | where {$_.psiscontainer}
- $DeadShows=$Dir.count
- if ($DeadSHows -le 0) {"no shows found - check constants"}
- #Create subsets based on names of the folders
- $deadsbds = $dir | where {$_.name -match ".sbd" }
- $deadbrkn = $dir | where {$_.name -match "broken" }
- $deadpart = $dir | where {$_.name -match "partial" }
- $deadauds = $dir | where {$_.name -match ".aud" }
- $deadunkw = $dir | where {$_.name -match ".unk"}
- # workout recording type
- $deadshn = $dir | where {$_.name -match ".shn"}
- $deadflac = $dir | where {$_.name -match ".flac"}
- $deadnocoding = $dir | where {$_.name -notmatch ".shn" -and $_.name -notmatch ".flac"}
- #and see how many have the md5ok's file?
- $DeadMD5Checked=0
- foreach ($d in $dir)
- {
- $sn=$d.fullname + "\md5check_ok"
- $md5ok= ls $sn -ea silentlycontinue
- if ($md5ok )
- {$DeadMD5Checked++}
- }
- # Get finishtime and calc elapsed
- $finishtime=Get-Date
- $executiontime = $finishtime - $starttime
- $min = $executiontime.minutes
- $sec = $executiontime.seconds
- #Display results
- "Grateful Dead Show Summary"
- "--------------------------"
- "Total shows: $deadshows"
- "Soundboards: $($deadsbds.count)"
- "Auds : $($deadauds.count)"
- "Unknown : $($deadunkw.count)"
- "Partial : $($deadpart.count)"
- "SHN : $($deadshn.count)"
- "FLAC : $($deadflac.count)"
- "No coding : $($deadnocoding.count)"
- "Broken : $($deadbrkn.count)"
- $DeadPctChecked=($DeadMD5checked/$DeadShows).tostring("P")
- "MD5's check: $DeadMD5checked ($DeadPctChecked)"
- "It took {0} minutes, {1} second(s)" -f $min,$sec
- ""
This blog contains PowerShell scripts, more PowerShell scripts and still more PowerShell scripts. Occasionally you may see some organisational posts.
Sunday, 1 February 2009
Count-GDShows2.ps1
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment