Monday, October 2, 2017

Frequency counts for music types for Itunes and Windows Media Player

Powershell script to enumerate all music file types including Windows Media Player and Itunes Libraries

#get media file type counts
$musicdir= $env:USERPROFILE+"\Music"
$cntsfile= $env:USERPROFILE+"\Music\MusicFileExtsCnt.txt"
Get-Childitem $musicdir -Recurse |
     WHERE { -NOT $_.PSIsContainer } | 
        Group Extension -NoElement | 
            Sort Count -Desc  > $cntsfile

#get computers age as of last update
$OS = Get-WmiObject -Class Win32_OperatingSystem 
$InstalledDate = $OS.ConvertToDateTime($OS.InstallDate) 
$Span = [datetime]::Now - $InstalledDate
$age = New-Object DateTime -ArgumentList $Span.Ticks
Write "Computer's age is:  $($age.Year -1) Years $($age.Month -1) Months $($age.Day) days old" | Add-Content $cntsfile


How to Run 


Cut and paste script into a file named MediaTypeCnts.ps1 in Downloads folder.


powershell "c:\Users\%username%\Downloads\mediatypecnts.ps1"

Results

A frequency counts for music types containing both Itunes, Windows Media Player and VLC libraries.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Count Name                     
----- ----                     
 2988 .itc2                    
 2500 .au                      
 1723 .mp3                     
  803 .m4a                     
  139 .wma                     
  122 .m4r                     
   93 .ipa                     
   52 .jpg                     
   49 .wav                     
   40 .m4v                     
   37 .wpl                     
   34 .mid                     
   30 .aup                     
   19 .itl                     
   14 .epub                    
   13 .mp4                     
   12 .tmp                     
   11 .pdf                     
    7 .m3u                     
    6 .psd                     
    6 .zip                     
    5 .txt                     
    3 .xml                     
    2 .sfv                     
    2 .jpeg                    
    2 .nfo                     
    2 .m3u8                    
    2 .pls                     
    2 .png                     
    2 .itdb                    
    1 .log                     
    1 .bat'                    
    1 .db                      
    1 .bat                     
    1 .hub                     
    1 .DS_Store                
    1 .rtf                     
    1 .plist                   
    1 .cue                     
    1 .bin                     
    1 .lnk            


Post Your Results
Post your results in comments below and I will publish them.

No comments:

Post a Comment